#include <bits/stdc++.h>
using namespace std;
struct node {
  int v, id, tag;
} a[100010];
int cmp1(node x, node y) { return x.v < y.v; }
int cmp2(node x, node y) { return x.id < y.id; }
int ccount[100010];
int main() {
  int n, tt;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].v), a[i].id = i;
  sort(a + 1, a + n + 1, cmp1);
  a[1].tag = tt = 1;
  ccount[tt] = 1;
  for (int i = 2; i <= n; i++) {
    if (a[i].v != a[i - 1].v) tt++;
    a[i].tag = tt;
    ccount[tt]++;
  }
  sort(a + 1, a + n + 1, cmp2);
  int nowh = 1, maxh = 0, block = 0;
  for (int i = 1; i <= n; i++) {
    ccount[a[i].tag]--;
    maxh = max(maxh, a[i].tag);
    while (!ccount[nowh]) nowh++;
    if (nowh >= maxh) block++;
  }
  printf("%d\n", block);
}
