#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  vector<int> p;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    p.push_back(temp);
  }
  int counter = 0;
  for (int i = 0; i < n - 1; i++) {
    int index = i + 1;
    if (p[i] == index) {
      counter++;
      int temp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = temp;
    }
  }
  cout << counter << endl;
  return 0;
}
