#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (auto& p : p) {
    cin >> p;
  }
  bool prev = false;
  int out = 0;
  for (int i = 0; i < p.size(); ++i) {
    if (p[i] == i + 1) {
      if (prev) {
        prev = false;
      } else {
        out++;
        prev = true;
      }
    } else {
      prev = false;
    }
  }
  cout << out << endl;
  return 0;
}
