The inventory keeper Viktor has been asked to tally the donation drive. On the desk lies a long table of ribbons readings. Task: Print the length of the longest contiguous run in which elements alternate even, odd, even, odd, ... Input format: First line: n. Second line: n integers. Output format: Print the maximum parity-alternating run length. Constraints: 1 <= n <= 1451; 1 <= a[i] <= 1000.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 1451; 1 <= a[i] <= 1000.
