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