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