Given a binary array, find the length of the longest contiguous subarray that contains an equal number of 0s and 1s.
Input format
Line 1: an integer n.
Line 2: n space-separated integers, each 0 or 1 (present whenever n >= 1).
Output format
One line: the length of the longest balanced subarray (0 if none exists).
Constraints
- 1 <= n <= 100000
- Each value is 0 or 1.