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