#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  vector<long long> p(N);
  for (long long i = 0; i < N; i++) {
    cin >> p[i];
    p[i]--;
  }
  long long ans = 0;
  for (long long i = 0; i + 1 < N; i++) {
    if (i == p[i]) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
