#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, odd = 0, even = 0, p;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> p;
    if (i % 2) {
      odd += i == p;
    } else {
      even += i == p;
    }
  }
  cout << max(odd, even);
}
