#include <bits/stdc++.h>
using namespace std;
int a[110000];
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  int count = 1;
  int ans = 0;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n - 1; ++i) {
    if (a[i + 1] > a[i])
      count++;
    else {
      ans += count;
      count = 1;
    }
  }
  cout << ans;
}
