#include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int N; cin >> N; vector A(N); for(int i=0; i> A[i]; } deque dq; set s; int ans = 0; for(int r=0; r 0){ int val = dq.front(); s.erase(val); dq.pop_front(); if(val == A[r]) break; } } s.insert( A[r] ); dq.push_back( A[r] ); ans = max(ans, (int)dq.size()); } cout << ans << endl; return 0; }