#include <bits/stdc++.h>
using namespace std;
int a[(int)(1e5 + 105)];
int main() {
  int n, cnt = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
