#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
multiset<int> a, b;
int ha[100005], hb[100005];
void fmain() {
  scanf("%d", &n);
  for (int(i) = 0; (i) < (int)(n); (i)++) scanf("%d", ha + i);
  for (int(i) = 0; (i) < (int)(n); (i)++) hb[i] = ha[i];
  sort(hb, hb + n);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    if (ha[i] != hb[i]) {
      auto it = b.find(ha[i]);
      if (it == b.end())
        a.insert(ha[i]);
      else
        b.erase(it);
      it = a.find(hb[i]);
      if (it == a.end())
        b.insert(hb[i]);
      else
        a.erase(it);
    }
    if (a.empty() && b.empty()) k++;
  }
  printf("%d\n", k);
}
int main() {
  fmain();
  return 0;
}
