#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, tmp = 0, k = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x == i && x >= tmp) k++;
    if (tmp < x) tmp = x;
  }
  cout << k;
}
