#include <bits/stdc++.h>
using namespace std;
int n;
int castle[100002];
vector<int> x;
int tambah[100002];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &castle[i]), x.push_back(castle[i]);
  sort(x.begin(), x.end());
  for (int i = 0; i < n; i++) {
    int idx = lower_bound(x.begin(), x.end(), castle[i]) - x.begin();
    castle[i] = idx + tambah[idx];
    tambah[idx]++;
  }
  int ans = 0;
  int now = -1;
  for (int i = 0; i < n; i++) {
    now = max(now, castle[i]);
    if (now == i) {
      ans++;
      now = -1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
