#include <bits/stdc++.h>
using namespace std;
long long mm = 1000000000;
long long MM = mm + 7;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  int cnt = 0;
  int cp = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1 && cp % 2 == 0) {
      cnt++;
      cp++;
    } else if (p[i] != i + 1) {
      cp = 0;
    }
  }
  cout << cnt << endl;
}
