#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  map<long long, long long> mp;
  for (long long i = 0; i < (N); i++) cin >> A[i];
  long long res = 0;
  for (long long i = 0; i < (N); i++) {
    if (i + 1 == A[i]) {
      swap(A[i], A[i + 1]);
      res++;
      continue;
    }
  }
  cout << res << endl;
}
