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