#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  long long ans = 0;
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (long long i = 1; i < N; i++) {
    if (A.at(i - 1) == i || A.at(i) == i + 1) {
      ans++;
      swap(A.at(i - 1), A.at(i));
    }
  }
  cout << ans << endl;
}
