#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[100005];
int main()
{
int n; cin >> n;
for(int i = 0; i < n; ++i)
cin >> a[i];
int maxi = 0;
set<int>se;
for(int i = 0; i < n; ++i)
{
if(se.find(a[i]) == se.end())
{
se.insert(a[i]);
}
else
{
maxi = max(maxi, (int)se.size());
se.clear();
se.insert(a[i]);
}
}
cout << max(maxi, (int)se.size());
}
//Tìm độ dài dãy dài nhất mà trong đoạn đó k giá trị nào trùng nhau
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgYVsxMDAwMDVdOwppbnQgbWFpbigpCnsKICAgIGludCBuOyBjaW4gPj4gbjsgCiAgICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgKytpKQogICAgICAgIGNpbiA+PiBhW2ldOyAKICAgIGludCBtYXhpID0gMDsKICAgIHNldDxpbnQ+c2U7CgogICAgZm9yKGludCBpID0gMDsgaSA8IG47ICsraSkKICAgIHsKICAgICAgICBpZihzZS5maW5kKGFbaV0pID09IHNlLmVuZCgpKQogICAgICAgIHsKICAgICAgICAgICAgc2UuaW5zZXJ0KGFbaV0pOwogICAgICAgIH0KICAgICAgICBlbHNlIAogICAgICAgIHsKICAgICAgICAgICAgbWF4aSA9IG1heChtYXhpLCAoaW50KXNlLnNpemUoKSk7IAogICAgICAgICAgICBzZS5jbGVhcigpOwogICAgICAgICAgICBzZS5pbnNlcnQoYVtpXSk7CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCBtYXgobWF4aSwgKGludClzZS5zaXplKCkpOwp9Ci8vVMOsbSDEkeG7mSBkw6BpIGTDo3kgZMOgaSBuaOG6pXQgbcOgIHRyb25nIMSRb+G6oW4gxJHDsyBrIGdpw6EgdHLhu4sgbsOgbyB0csO5bmcgbmhhdQo=