#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(100000);
  vector<int> b(100000, 0);
  int n, bef = 0, c = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (bef > a[i]) c++;
    bef = a[i];
  }
  cout << c << endl;
}
