#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  int A[N + 1];
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
  long long cnt = 0;
  for (int i = 1; i < N; i++) {
    if (A[i] == i) {
      A[i] = A[i + 1];
      A[i + 1] = i;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
