#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p[n];
  for (int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  int tmp;
  if (n % 2 == 0) {
    for (int i = 0; i < n - 1; i += 2) {
      if (p[i] == i + 1 || p[i + 1] == i + 2) {
        tmp = p[i + 1];
        p[i + 1] = p[i];
        p[i] = tmp;
        ans++;
      }
    }
  } else {
    if (p[n - 1] == n || p[n - 2] == n - 1) {
      tmp = p[n - 1];
      p[n - 1] = p[n - 2];
      p[n - 2] = tmp;
      ans++;
    }
    for (int i = 0; i < n - 1; i += 2) {
      if (p[i] == i + 1 || p[i + 1] == i + 2) {
        tmp = p[i + 1];
        p[i + 1] = p[i];
        p[i] = tmp;
        ans++;
      }
    }
  }
  cout << ans;
}
