#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <typename T>
void swapAlgorithm(T& a, T& b) {
  T tmp = a;
  a = b;
  b = tmp;
}
LL euclideanAlgorithm(LL a, LL b) {
  LL a_tmp = a;
  LL b_tmp = b;
  if (a_tmp > b_tmp) {
    swapAlgorithm<LL>(a_tmp, b_tmp);
  }
  LL r = a_tmp % b_tmp;
  while (r != 0) {
    a_tmp = b_tmp;
    b_tmp = r;
    r = a_tmp % b_tmp;
  }
  return b_tmp;
}
LL getLCM(LL a, LL b) { return (a * b) / (euclideanAlgorithm(a, b)); }
double eauclidDistance(pair<double, double>& x1, pair<double, double>& x2) {
  return sqrt((x1.first - x2.first) * (x1.first - x2.first) +
              (x1.second - x2.second) * (x1.second - x2.second));
}
void swap(int& a, int& b) {
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}
int main(int argc, char const* argv[]) {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if ((i + 1) == p[i] || (i + 2) == p[i + 1]) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
