#include <bits/stdc++.h>
using namespace std;
bool comp(long a, long b) {
  if (a > b) return 1;
  return 0;
}
int main() {
  long N, a[100005], b[100005], c[100005], ind[100005], mx, cnt;
  map<long, vector<long> > inds;
  cnt = -1;
  mx = -1;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> b[i];
    a[i] = b[i];
    ind[b[i]] = i;
  }
  sort(a, a + N);
  for (int i = 0; i < N; i++) {
    inds[a[i]].push_back(i);
    push_heap(inds[a[i]].begin(), inds[a[i]].end(), comp);
  }
  for (int i = 0; i < N; i++) {
    pop_heap(inds[b[i]].begin(), inds[b[i]].end(), comp);
    c[i] = inds[b[i]].back();
    inds[b[i]].pop_back();
  }
  for (int i = 0; i < N; i++) {
    if (i > mx) {
      cnt++;
      mx = c[i];
    }
    if (c[i] > mx) mx = c[i];
  }
  cnt++;
  cout << cnt;
}
