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