Longest Distinct Segment
Longest Distinct Segment
Find the maximum length of a contiguous segment in which every value is distinct.
Input
The first line contains n (1 ≤ n ≤ 200000). The second line contains n integers |aᵢ| ≤ 10^9.
Output
Print the maximum valid segment length.
Example 1
Input
8 1 2 1 3 2 7 4 2
Output
5
Example 2
Input
5 1 2 3 4 5
Output
5
Comments