#include <bits/stdc++.h>
using namespace std;
const int inf = 1001001000;
const long long INF = 1LL << 60;
const int MOD = (int)1e9 + 7;
int main() {
  int N;
  long long ans = 0LL;
  cin >> N;
  vector<long long> in(3 * N);
  for (int i = 0; i < N; ++i) cin >> in[i];
  for (int i = 0; i < N; ++i) {
    if (i % 2 == 0) {
      if (in[i] == i + 1 || in[i + 1] == i + 2) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
