#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e4 + 5;
const int mod = 10007;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
int a[maxn];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  int pl = 1;
  int cnt = 0;
  while (1) {
    if (pl > n) break;
    cnt++;
    int flag = 1;
    int tt = pl;
    int las = 0;
    while (1) {
      if (pl > n) break;
      int maxx = 0;
      for (int j = pl; j <= max(a[pl], las); j++) {
        maxx = max(maxx, a[j]);
      }
      if (max(a[pl], las) >= maxx) {
        pl = max(a[pl], las);
        break;
      } else {
        pl = a[pl] + 1;
        las = maxx;
      }
    }
    pl++;
  }
  cout << cnt << "\n";
}
