#include <bits/stdc++.h>
#pragma comment(linker, "/stack:20000000")
using namespace std;
void redirectIO() {}
int h[101000];
int n;
int sorted[101000];
int main() {
  redirectIO();
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> h[i];
      sorted[i] = h[i];
    }
    sort(sorted, sorted + n);
    map<int, int> found;
    int miss = 0;
    int res = 0;
    for (int i = 0; i < n; i++) {
      if (sorted[i] != h[i]) {
        found[sorted[i]]++;
        if (found[sorted[i]] == 0)
          miss--;
        else if (found[sorted[i]] == 1)
          miss++;
        found[h[i]]--;
        if (found[h[i]] == 0)
          miss--;
        else if (found[h[i]] == -1)
          miss++;
      }
      if (miss == 0) res++;
    }
    cout << res << endl;
  }
  return 0;
}
