#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  int cnt = 0;
  for (int i = 0; i < (n); ++i) {
    int tmp_p;
    cin >> tmp_p;
    p[i] = tmp_p;
    if (i == 0) {
      continue;
    }
    if (p[i - 1] == i || p[i] == i + 1) {
      swap(p[i - 1], p[i]);
      ++cnt;
    }
  }
  cout << cnt << endl;
  return 0;
}
