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