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