#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll cnt = 0;
  for (ll i = 0; i < n; i += 2) {
    if (a[i] == i + 1 || (i + 1 < n && a[i + 1] == i + 2)) {
      cnt++;
    }
  }
  cout << cnt << endl;
  ;
}
