After getting over the initial shock of the variety of candy apples, Molly finally decides to explore the carnival.
However, she had not taken two steps when the sign of a giant manga booth caught her eye. There are
Molly is eager to explore the rest of the carnival but cannot resist perusing this grand selection of manga. However, Molly is a cat and therefore cannot read. Additionally, she can only focus on one contiguous interval of the manga display at a time.
You recall that Molly considers a series of manga in an interval interesting if their frequency in that interval is even (and positive).
Can you write a program to help Molly determine the amount of interesting manga?
Input Specification
Line
Line
Line
Next
Output Specification
Your program should output
Constraints
For all subtasks:
Subtask | Points | ||
---|---|---|---|
1 | 30 | ||
2 | 70 |
Sample Input
5
1 2 3 2 1
3
3 3
2 4
1 5
Sample Output
0
1
2
Comments