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