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