#include <bits/stdc++.h>
int main() {
  int i, j, N, max = 0;
  double count = 0, sum = 0;
  scanf("%d", &N);
  int p[N];
  for (i = 0; i < N; i++) {
    scanf("%d", p + i);
  }
  for (j = 0; j < N; j++) {
    if (p[j] == j + 1) {
      count += 1;
    } else if (p[j] != j + 1) {
      sum += ceil(count / 2.0);
      count = 0;
    }
  }
  if (count == N) sum = N / 2 + 1;
  printf("%.0f", sum);
  return 0;
}
