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