#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, cnt, a;
  bool flag = false;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> a;
    if (a == i && flag == false) {
      flag = true;
    } else if (flag == true) {
      flag = false;
      cnt++;
    }
  }
  if (flag == true) {
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
