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