#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> ps(N);
  for (auto& p : ps) cin >> p;
  int c = 0;
  int len = 0;
  for (int i = 0; i != N; ++i) {
    if (ps[i] == i + 1) {
      ++len;
    } else {
      c += (len + 1) / 2;
      len = 0;
    }
  }
  cout << c << endl;
  return 0;
}
