#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d = 0, t = 0, k;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    t = max(t, k = max(i + 1, a[i]));
    if (i + 1 == t) d++;
  }
  cout << d;
  return 0;
}
