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