#include "bits/stdc++.h" #ifndef err #undef assert #define assert(ok) if (!(ok)) exit(1); #define err(...) #endif using namespace std; void Calc(); #define ALL(a) begin(a),end(a) #define RALL(a) (a).rbegin(),(a).rend() typedef int64_t ll; typedef uint64_t ull; int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); Calc(); cout.flush(); return 0; } struct Scanner { template A Next() { A a; cin >> a; return a; } template vector Array(int n) { vector a(n); for (A&i : a) cin >> i; return a; } string Line() { string s; getline(cin, s); return s; } int Int() { return Next(); } templateScanner&operator,(A&a) { a = Next(); return *this; } templateoperator A() { return Next(); } }in; /*---------------------------------------------------------------------*/ void Calc() { int n = in; auto a = in.Array(n); int maxi = 0; int cnt = 0; for (auto& i : a) { if (maxi > i) { cnt++; } else { maxi = i; } } cout << (cnt) << endl; }