#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l, a[1000009], b[1000009], p[1000009], ans, cn, t, x, y, z,
    mx, mn, s;
char c[1000009], d[1000009], ch;
struct point {
  int num, pos;
} pp[1000009];
bool cmp(point a1, point a2) {
  if (a1.num == a2.num) {
    return a1.pos < a2.pos;
  } else {
    return a1.num < a2.num;
  }
}
int main() {
  while (scanf("%d", &n) != EOF) {
    ans = 0;
    x = -1;
    for (i = 0; i < n; i++) {
      scanf("%d", &pp[i].num);
      pp[i].pos = i;
    }
    sort(pp, pp + n, cmp);
    for (i = 0; i < n; i++) {
      if (i > x) {
        x = pp[i].pos;
        ans++;
      } else {
        x = max(x, pp[i].pos);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
