#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int c = 0;
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) cin >> p[i];
  for (int i = 0; i < N - 1; i++) {
    if (i + 1 == p[i]) {
      int t = p[i];
      p[i] = p[i + 1];
      p[i + 1] = t;
      c++;
    }
  }
  cout << c << endl;
}
