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