#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, c = 0;
  cin >> n;
  long long a[n];
  long long mx = INT_MAX;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  for (long long i = 0; i < n - 1; i++) {
    if (a[i] < a[i + 1]) {
      c++;
    }
  }
  if (c == 0)
    cout << 0 << endl;
  else {
    cout << n - c << endl;
  }
}
