#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> vp(n);
  for (int i = 0; i < n; ++i) {
    cin >> vp[i];
  }
  int ans = 0;
  if (vp[0] == 1) {
    swap(vp[0], vp[1]);
    ans++;
  }
  for (int i = 1; i < vp.size(); ++i) {
    if (vp[i] == i + 1) {
      swap(vp[i], vp[i - 1]);
      ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
