B. Necklace
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A jeweler is assembling a necklace from multicolored beads and wants to slightly change its appearance.

There are $$$n$$$ beads on a string. The color of the $$$i$$$-th bead is given by an integer $$$a_i$$$. We will assume that the necklace is not cyclic, that is, the first and the last beads are not considered adjacent.

The jeweler must choose exactly one color $$$x$$$ and remove all beads of that color from the necklace. After that, the remaining beads shift while preserving their relative order. Before performing this operation, there must be at least one bead of color $$$x$$$ in the necklace.

It is necessary to determine the maximum number of consecutive beads of the same color that can be obtained after performing this operation.

Input

The first line of the input contains one integer $$$n$$$ $$$(1 \le n \le 10^6)$$$ — the number of beads in the necklace.

The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le n)$$$ — the colors of the beads in the order they are arranged on the string.

Output

Print one integer in a single line — the maximum number of consecutive beads of the same color that can be obtained after removing all beads of one chosen color.

Examples
Input
3
1 1 1
Output
0
Input
7
1 2 1 3 1 1 2
Output
3