Longest Distinct Stretch
You are given an array of n integers a_1, a_2, ..., a_n.
A stretch is a contiguous segment a_l, a_{l+1}, ..., a_r with 1 ≤ l ≤ r ≤ n. A stretch is distinct if no value appears in it more than once.
Find the length of the longest distinct stretch.
Input
The first line contains a single integer n (1 ≤ n ≤ 2·10^5).
The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9).
Output
Print one integer: the largest value of r − l + 1 over all distinct stretches.
Notes
In the first example, the longest distinct stretch is 4 1 5 9 2 6 (positions 3 to 8), of length 6. Extending it to the left would add a second 1, and extending it to the right would add a second 5.
In the second example, all values are equal, so every distinct stretch has length 1.