#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
const int inf = 1e9 + 5;
int a[N];
struct node {
  int l, r;
  int ma;
  int mi;
} tree[4 * N];
void build(int rt, int s, int t) {
  tree[rt].l = s, tree[rt].r = t;
  tree[rt].ma = -inf, tree[rt].mi = inf;
  if (s == t) {
    tree[rt].ma = a[s];
    tree[rt].mi = a[s];
    return;
  } else {
    int mid = (s + t) >> 1;
    build(rt << 1, s, mid);
    build(rt << 1 | 1, mid + 1, t);
    tree[rt].ma = max(tree[rt << 1].ma, tree[rt << 1 | 1].ma);
    tree[rt].mi = min(tree[rt << 1].mi, tree[rt << 1 | 1].mi);
  }
}
int queryma(int rt, int s, int t) {
  int L = tree[rt].l, R = tree[rt].r;
  if (s <= L && R <= t) {
    return tree[rt].ma;
  } else {
    int mid = (L + R) >> 1;
    int mi1 = -inf, mi2 = -inf;
    if (s <= mid) mi1 = queryma(rt << 1, s, t);
    if (t > mid) mi2 = queryma(rt << 1 | 1, s, t);
    return max(mi1, mi2);
  }
}
int querymi(int rt, int s, int t) {
  int L = tree[rt].l, R = tree[rt].r;
  if (s <= L && R <= t) {
    return tree[rt].mi;
  } else {
    int mid = (L + R) >> 1;
    int mi1 = inf, mi2 = inf;
    if (s <= mid) mi1 = querymi(rt << 1, s, t);
    if (t > mid) mi2 = querymi(rt << 1 | 1, s, t);
    return min(mi1, mi2);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  build(1, 1, n);
  int ans = 1;
  int temp = 1;
  for (int i = 1; i < n; i++) {
    if (queryma(1, temp, i) <= querymi(1, i + 1, n)) {
      ans++;
      temp = i + 1;
    }
  }
  printf("%d\n", ans);
}
