#include <bits/stdc++.h>
using namespace std;
int main() {
  int s[] = {}, n;
  int p = 0;
  cin >> n;
  for (int i = 0; i <= n - 1; i++) {
    cin >> s[i];
  }
  for (int l = 0; l < n - 1; l++) {
    if (s[l] == l + 1 && l != n) {
      int m = s[l + 1];
      s[l + 1] = s[l];
      s[l + 1] = m;
      p++;
    }
  }
  cout << p;
}
