#include <bits/stdc++.h>
using namespace std;
int main() {
  long i = 0;
  long N;
  long a;
  int count = 0;
  std::vector<long> v;
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> a;
    v.push_back(a - 1);
  }
  for (i = 0; i < N - 1; i++) {
    if (v[i] == i) {
      swap(v[i], v[i + 1]);
      count++;
    }
  }
  cout << count;
  return 0;
}
