#include <bits/stdc++.h>
int main(void) {
  int N;
  scanf("%d", &N);
  int pi[N + 1];
  for (int i = 1; i <= N; i++) {
    scanf("%d", &(pi[i]));
  }
  int count = 0;
  for (int i = 1; i < N; i++) {
    if (pi[i] == i) {
      int tmp = pi[i];
      pi[i] = pi[i + 1];
      pi[i + 1] = tmp;
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
