#include <stdio.h>

int main(void) {
  int i, n, ans = 0, p;
  bool b = true;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%d", &p);
    if(p == i + 1 && b) ans++, b = false;
    else b = true;
  }
  printf("%d", ans);
  return 0;
}