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