#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int MX = 3e5 + 9;
int n, a[MX];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int i = 1, ans;
  for (ans = 0;; ans++) {
    int mx = 0;
    if (i == n + 1) break;
    if (i == a[i]) {
      i++;
      continue;
    }
    for (int j = i; j <= a[i]; j++) {
      i = max(i, a[j]);
      if (i == n) break;
    }
    if (i == n + 1) break;
    i++;
  }
  cout << ans << endl;
}
