#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int p[N + 1];
  for (int i = 1; i <= N; i++) cin >> p[i];
  int cnt = 0;
  for (int i = 1; i < N; i++) {
    if (i == p[i]) {
      int tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
