#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, swap = 0;
  cin >> N;
  int p[N];
  cin >> p[0] >> p[1];
  if (p[0] == 1 || p[1] == 2) {
    int tp;
    tp = p[0];
    p[1] = p[0];
    p[0] = tp;
    swap += 1;
  }
  for (int i = 2; i < N; i++) {
    cin >> p[i];
    if (p[i] == i + 1) {
      int tmp;
      tmp = p[i - 1];
      p[i - 1] = p[i];
      p[i] = p[i - 1];
      swap += 1;
    }
  }
  cout << swap << endl;
  return 0;
}
