#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  int* p;
  int count = 0;
  int point = 0;
  cin >> n;
  p = new int[n + 1];
  for (int i = (1); i < (n + 1); i++) {
    cin >> p[i];
  }
  for (int i = (1); i < (n); i++) {
    if ((p[i] == i) && (p[i + 1] == i + 1)) {
      i++;
      point++;
    } else if (p[i] == i) {
      count++;
      i++;
    }
  }
  count = count + point;
  cout << count << endl;
  delete[] p;
  return 0;
}
