ODDEVEN
You are given a sequence , , consisting of positive integers. We are asked to calculate the width of the largest interval in the sequence where the number of even integers equals the number of odd integers.
Input
The first line of input will contain the number of elements in the sequence, . The second line of input will contain positive integers separated by spaces, representing the sequence.
Output
The output should consist of a single line containing exactly one integer, the width of the largest interval in the sequence where the number of even integers equals the number of odd integers. If no such interval exists, the output should be .
Constraints
.
Execution time limit: 1 sec.
Maximum available memory: 16 MB.
Examples of Input - Output
1st
STDIN (oddeven.in)
5
7 8 9 6 5
STDOUT (oddeven.out)
4
2nd
STDIN (oddeven.in)
10
1 2 1 2 1 2 2 1 1 1
STDOUT (oddeven.out)
8
3d
STDIN (oddeven.in)
10
4 6 8 2 2 6 8 4 2 8
STDOUT (oddeven.out)
0
Comments