#include <bits/stdc++.h>
using namespace std;
long long a[200001];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, cnt = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 1; i < n; i++) {
    if (a[i] < a[i - 1]) {
      cnt++;
      a[i] = a[i - 1];
    }
  }
  cout << cnt << endl;
  return 0;
}
