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