#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    num--;
    vec[i] = num;
  }
  int cnt = 0;
  if (vec[n - 1] == n - 1) {
    int tmp = vec[n - 1];
    vec[n - 1] = vec[n - 2];
    vec[n - 2] = tmp;
    cnt++;
  }
  for (int i = 0; i < n - 1; i++) {
    if (vec[i] == i) {
      int tmp = vec[i];
      vec[i] = vec[i + 1];
      vec[i + 1] = tmp;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
