#include <bits/stdc++.h>
using namespace std;
long long b[200];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long n;
  cin >> n;
  long long a[n];
  b[0] = a[0];
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (i == 0) {
      b[0] = a[0];
    } else {
      b[i] = max(b[i - 1], a[i]);
    }
  }
  long long ans = 0;
  for (long long i = n - 1; i > 0; --i) {
    ++ans;
    if (a[i] == b[i]) {
      break;
    }
  }
  cout << n - ans;
  return 0;
}
