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