#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long to;
  long long cost;
};
int solve() {
  long long n;
  cin >> n;
  vector<long long> p(n);
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  long long ans = 0;
  long long r, l;
  for (long long i = 0; i < n - 1; i++) {
    if (i + 1 == p[i]) {
      long long tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
int main(void) {
  solve();
  return 0;
}
