#include <bits/stdc++.h>
using namespace std;
long long maxi(long long arr[], long long n, long long j) {
  long long a = arr[j];
  long long b = arr[j];
  long long c = j;
  for (long long i = j; i < a; i++) {
    if (b < arr[i]) {
      b = arr[i];
      c = i;
    }
  }
  if (b > arr[j]) return maxi(arr, n, c);
  return b;
}
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long count = 0, j = 0;
  while (j < n) {
    long long x = maxi(arr, n, j);
    j = x;
    count++;
  }
  cout << count;
}
