#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  int *p = new int[N];
  for (int i = 0; i < N; i++) scanf("%d", &p[i]);
  int result = 0;
  for (int i = 0; i < N - 1; i++) {
    if (p[i] == i + 1) {
      if (p[i + 1] == i + 2) i++;
      swap(p[i], p[i + 1]);
      result++;
    }
  }
  if (p[N - 1] == N) swap(p[N - 1], p[N - 2]);
  printf("%d\n", result);
}
