#include <bits/stdc++.h>
using namespace std;
int main()
{
int n; scanf("%d", &n);
int array[n];
for (int i = 0; i < n; ++i)
{
scanf("%d", &array[i]);
}
int max = 0, temp;
for (int i = 0; i < n; ++i)
{
for (int j = i; j < n; ++j)
{
if (array[i] == array[j])
temp = j - i;
if (temp > max)
max = temp;
}
}
printf("%d\n", max+1);
return 0;
}