#include <bits/stdc++.h>
int main(int argc, char *argv[]) {
  int n;
  scanf("%d", &n);
  int p[100000];
  int ans = 0, l;
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    if (p[i] == i + 1)
      l++;
    else {
      ans += l / 2 + l % 2;
      l = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}
