#include <bits/stdc++.h>
using namespace std;
const int N = 2010, M = 2 * N;
int n;
int a[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int res = 0;
  for (int i = 1; i <= n; i += 2)
    if (a[i] == i || a[i + 1] == i + 1) {
      swap(a[i], a[i + 1]);
      res++;
    }
  if (n % 2 && a[n] == n) res++;
  cout << res << endl;
  return 0;
}
