#include <bits/stdc++.h>
using namespace std;
int n, mx, cnt, a[100005], sr[100005];
map<int, int> mp;
int main() {
  int ps;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sr[i] = a[i];
  }
  sort(sr + 1, sr + 1 + n);
  for (int i = 1; i <= n; i++) {
    int j;
    for (j = i; j <= n && sr[j + 1] == sr[j]; j++)
      ;
    mp[sr[i]] = i;
    i = j;
  }
  for (int i = 1; i <= n; i++) {
    if (i > mx) {
      mx = i;
      cnt++;
    }
    ps = mp[a[i]]++;
    if (i < ps) mx = max(mx, ps);
  }
  printf("%d\n", cnt);
  return 0;
}
