#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int p, res = 0;
  int prev = -10;
  for (int i = 0; i < N; ++i) {
    cin >> p;
    if (((i + 1) - p) == 0) {
      if (i != prev + 1) {
        ++res;
      }
      prev = i;
    }
  }
  cout << res << endl;
  return 0;
}
