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