Imagine a row of N light switches, each attached to a light bulb. All the bulbs are off to start with. You are going to release your inner child so they can run back and forth along this row of light switches, flipping bunches of switches from on to off or vice versa. The challenge will be to figure out the state of the lights after this fun happens.
INPUT:
1) The number of switches/bulbs (N) is specified between 4-10.
2) On the remaining lines, there will be 4 pairs of integers indicating ranges of switches that your inner child turns on/off as they run back and forth. These ranges are inclusive (both their end points, along with everything between them is included), and the positions of switches are zero-indexed (so the possible positions range from 0 to N-1).
OUTPUT:
The number of light bulbs on.
0123456789
10 ..........
3-6 ||||
...XXXX...
0-4 |||||
XXX..XX...
7-3 |||||
XXXXX..X..
9-9 |
XXXXX..X.X
7 lights are ON