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