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