#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int res = 0;
  int h[100004];
  int mios[100004];
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }
  for (int i = n - 1; i >= 0; --i) {
    if (i == n - 1)
      mios[i] = h[i];
    else
      mios[i] = min(mios[i + 1], h[i]);
  }
  int povk = -1;
  int mabl = 1;
  for (;;) {
    ++povk;
    if (povk >= n) break;
    mabl = max(mabl, h[povk]);
    for (int i = povk + 1; i < n; ++i) {
      if (mios[i] >= mabl) break;
      if (h[i] > mabl) mabl = h[i];
      if (h[i] < mabl) povk = i;
    }
    ++res;
  }
  cout << res;
  return 0;
}
