#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P[i];
    P[i]--;
  }
  int count = 0;
  for (int i = 0; i + 1 < N; i++) {
    if (P[i] == i or P[i + 1] == i + 1) {
      swap(P[i], P[i + 1]);
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
