#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> p(N, 0);
  for (int i = 0; i < N; i++) cin >> p[i];
  int count = 0;
  bool status = false;
  for (int i = 0; i < N; i++) {
    if (p[i] == i + 1) {
      status = true;
      continue;
    }
    if (status == true) {
      count++;
      status = false;
    }
  }
  if (status == true) count++;
  cout << count << endl;
}
