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