#include "bits/stdc++.h" using namespace std; #define int long long #define PB push_back #define PPB pop_back typedef pair pii; typedef pair pdd; static const int INF = 1LL << 61; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, ans = 0, tmax = 0; cin >> n; for (int i = 0; i < n; ++i) { int t; cin >> t; if (t < tmax) ans++; else tmax = t; } cout << ans << endl; }