#include using namespace std; #define _GLIBCXX_DEBUG #define dump(c) cerr << "> " << #c << " = " << (c) << endl #define all(c) ((c).begin()), ((c).end()) #define rep(i, n) for(int i=0;i<(int)n;i++) #define FOR(i, s, e) for(int (i)=(int)(s);(i)<(int)(e);++(i)) #define inf 0x3f3f3f3f #define infl 0x3f3f3f3f3f3f3f3fLL typedef long long ll; typedef unsigned long long ull; void print_vector(vector v){rep(i,v.size()){if(i<(int)v.size()-1){cout<> N; vector a(N); vector b(N); vector a_index(N+1); for (int i = 0; i < N; ++i) cin >> a[i]; b = a; sort(all(b)); // print_vector(a); // print_vector(b); int count = 0; // while(a!=b){ // print_vector(a); // for (int i = 0; i < N; ++i) { // a_index[a[i]] = i; // } // for (int i = N-1; i >= 0; --i) { // if (a_index[i+1] a[j]) { count++; }else{ d = a[j]; } } cout << count << endl; return 0; }