#include using namespace std; //#include //using namespace atcoder; using ll = long long; using ull = unsigned long long; #define rep(i,n) for(int i=0;i<(n);++i) int a[3<<17]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for(int i=0;i> a[i]; } set st; int f=4,b=0; for(int i=0;i=0;--i){ st.insert(a[i]); if(st.size()!=n-i){ b = i; break; } } cout << max(0,f-b) << endl; for(int i=b;i