#include <bits/stdc++.h>
using namespace std;
int main() {
  long long nn, ans = 0;
  cin >> nn;
  vector<long long> hh(nn);
  for (long long ii = 0; ii < nn; ii++) {
    cin >> hh[ii];
  }
  for (long long ii = 1; ii < nn; ii++) {
    if (hh[ii - 1] <= hh[ii]) {
      ans++;
    } else {
      hh[ii] = hh[ii - 1];
    }
  }
  cout << ans << endl;
}
