#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int j = 0; j < n - 1; j++) {
    int tmp1 = p[j];
    int tmp2 = p[j + 1];
    if (tmp1 == j + 1 || tmp2 == j + 2) {
      ans++;
      p[j] = tmp2;
      p[j + 1] = tmp1;
    }
  }
  cout << ans << endl;
}
