#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, p[100001], cnt, i;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> p[i];
  cnt = 0;
  for (i = 1; i < n; i++) {
    if (p[i] == i || p[i + 1] == i + 1) {
      swap(p[i], p[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
