#include <bits/stdc++.h>
using namespace std;
map<int, int> mpp;
int n, i, res, arr[100010], brr[100010], neg, pos;
int main() {
  scanf(" %d", &n);
  for (i = 0; i < n; i++) {
    scanf(" %d", &arr[i]);
    brr[i] = arr[i];
  }
  sort(brr, brr + n);
  res = 0;
  neg = pos = 0;
  for (i = 0; i < n; i++) {
    if (arr[i] != brr[i]) {
      if (mpp[arr[i]] == 0) pos++;
      if (mpp[brr[i]] == 0) neg++;
    }
    mpp[arr[i]]++;
    mpp[brr[i]]--;
    if (arr[i] != brr[i]) {
      if (mpp[arr[i]] == 0) neg--;
      if (mpp[brr[i]] == 0) pos--;
    }
    if (neg == 0 && pos == 0) {
      res++;
    }
  }
  printf("%d\n", res);
  return 0;
}
