A toy store has just opened and is giving away free colored marbles. Xiao Ming decides to take advantage of this.
The store owner has arranged $n$ marbles in a row, where the $i$-th marble has a color $c_i$. Xiao Ming can choose a single contiguous subsegment of these marbles and take all marbles within that subsegment that appear exactly once in that subsegment.
Xiao Ming wants to know the maximum number of marbles he can take.
Input
The first line contains a positive integer $n$, representing the number of marbles. The second line contains $n$ space-separated integers, where the $i$-th number represents the color $c_i$ of the marble.
Output
A single integer representing the maximum number of marbles Xiao Ming can take.
Examples
Input 1
10 1 2 3 6 6 3 7 9 8 8
Output 1
5
Note 1
By choosing the subsegment $[1, 9]$, he takes the marbles with colors 1, 2, 7, 8, and 9, totaling 5 marbles. Since the marbles with colors 3 and 6 both appear twice, they cannot be chosen.
Subtasks
For $30\%$ of the data, $n \le 10^3$.
For $100\%$ of the data, $n \le 3 \times 10^5$ and $1 \le c_i \le n$.