#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  vector<int> neko;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    neko.push_back(tmp);
  }
  int cnt = 0;
  for (int i = 1; i <= N - 1; i++) {
    if (neko[i - 1] == i || neko[i] == i + 1) {
      int tmp = neko[i - 1];
      neko[i - 1] = neko[i];
      neko[i] = tmp;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
