#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int inplace = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    int p;
    cin >> p;
    if (p == i + 1)
      ++inplace;
    else {
      ans += (inplace + 1) / 2;
      inplace = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
