#include using namespace std ; #define pb(n) push_back(n) #define fi first #define se second #define X real() #define Y imag() #define all(r) (r).begin(),(r).end() #define gsort(st,en) sort((st),(en),greater()) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout<<#x<<": "< name(size,init) #define rep(i,n) for(int i = 0; i < (int)(n);++i) #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) #define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it) #define repa(n,array) for(auto &n :(array)) using ll = long long; using vi = vector; using vl = vector; using dict = map; using comd = complex; using pii = pair ; constexpr int imax = ((1<<30)-1)*2+1 ; constexpr int inf = 100000000; constexpr double PI = acos(-1.0) ; double eps = 1e-10 ; const int dy[] = {-1,0,1,0}; const int dx[] = {0,-1,0,1}; inline bool value(int x,int y,int w,int h){ return (x >= 0 && x < w && y >= 0 && y < h); } double CalcDist(comd p1, comd p2){ return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0)); } template void Unique(vector &v){ sort(all(v)); v.erase(all(v),v.end()); } template T ston(string& str, T n){ istringstream sin(str) ; T num ; sin >> num ; return num ; } void Ans(bool f){ if(f) cout << "YES"<> N; vary(int,v,N,0); rep(i,N){ cin >> v[i]; } int a = 1; int num = 0; while(a <= N){ num = 0; vector v2(0); if(a == N) break; rep(i,v.size()){ if(v[i] == a){ v[i] = inf; ++num; ++a; } else{ v2.pb(v[i]); } } v = v2; ans += num; } cout << ans -num<< endl; return 0; }