A roster lists n seats in a row, each holding a team id. Two team ids x and y are singled out. Find the length of the longest contiguous window in which team x and team y appear the same number of times. Seats holding other team ids do not affect the balance and may be included freely. A window with zero of both x and y counts as balanced. If no window is balanced, the answer is 0.
Input format
Line 1: three integers n, x, and y (with x != y).
Line 2: n space-separated integers, the team ids in seat order.
Output format
A single integer: the length of the longest window with equal counts of x and y.
Constraints
- 1 <= n <= 40
- 1 <= x, y <= 1000000 and x != y
- 1 <= each team id <= 1000000