#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, p[100000], mn = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> p[i];
  for (int i = 1; i < N; i++) {
    if (p[i] != i)
      continue;
    else {
      int t;
      t = p[i];
      p[i] = p[i + 1];
      p[i + 1] = t;
      mn++;
    }
  }
  cout << mn << endl;
  return 0;
}
