#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  int cnt = 0;
  int tmp = 0;
  for (int i = 0; i < N; i++) {
    if (p[i] == i + 1) {
      tmp++;
    } else {
      if (tmp <= 1) {
        cnt += tmp;
      } else {
        cnt += tmp - 1;
      }
      tmp = 0;
    }
  }
  if (tmp <= 1) {
    cnt += tmp;
  } else {
    cnt += tmp - 1;
  }
  cout << cnt << endl;
}
