#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  int n, ans;
  cin >> n;
  int p[n];
  bool flag[n];
  for (long long i = 0; i < (n); i++) flag[i] = false;
  for (long long i = 0; i < (n); i++) {
    cin >> p[i];
    p[i]--;
    if (p[i] == i) flag[i] = true;
  }
  ans = 0;
  for (int i = 0; i < n; i += 2) {
    if (flag[i]) {
      swap(p[i], p[i + 1]);
      ans++;
      flag[i] = false;
      flag[i + 1] = false;
    }
  }
  cout << ans << endl;
  return 0;
}
