#include <bits/stdc++.h>
using namespace std;
int main() {
  long long nn, ans = 0;
  cin >> nn;
  vector<long long> pp(nn + 1);
  for (long long ii = 1; ii <= nn; ii++) {
    cin >> pp[ii];
  }
  for (long long ii = 1; ii <= nn; ii++) {
    if (ii != pp[ii]) {
      continue;
    }
    if (ii != 1) {
      pp[ii] ^= pp[ii - 1];
      pp[ii - 1] ^= pp[ii];
      pp[ii] ^= pp[ii - 1];
      ans++;
      continue;
    }
    if (ii == 1) {
      pp[ii] ^= pp[ii + 1];
      pp[ii + 1] ^= pp[ii];
      pp[ii] ^= pp[ii + 1];
      ans++;
      continue;
    }
  }
  cout << ans << endl;
  return 0;
}
