#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int res = 0;
  int before = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    if (i == a) {
      before += 1;
    } else {
      res += (before + 1) / 2;
      before = 0;
    }
  }
  printf("%d\n", res);
  return 0;
}
