#include <bits/stdc++.h>
int a[100010];
bool boolean = false;
int main() {
  int n;
  int ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n;) {
    if (a[i] == i) {
      a[i] = 0;
      a[i + 1] = 0;
      ans++;
      i += 2;
    } else {
      a[i] = 0;
      i += 1;
    }
  }
  if (a[n] != 0 && a[n - 1] == 0) ans++;
  printf("%d", ans);
  return 0;
}
