#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[100101] = {};
  cin >> N;
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    int in;
    cin >> in;
    in--;
    if (i == in) {
      cnt++, i++;
    }
  }
  cout << cnt << endl;
}
