#include <bits/stdc++.h>
using namespace std;
int main() {
  ifstream fin("input.txt");
  long long N, i = 0, p, cnt = 0;
  fin >> N;
  vector<long long> vec(N);
  while (i < N) {
    fin >> p;
    vec[i] = p;
    i++;
  }
  for (long long i = 1; i < N; i++) {
    if (vec[i - 1] == i) {
      swap(vec[i], vec[i - 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
}
