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