#include <iostream>
#include <vector>

using namespaee std;

int main() {
  int n = 0;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; i++) {
    cin >> a.at(i);
  }
  int cnt = 0;
  for (int i=0; i<n; i++) {
    if (i+1 == a.at(i)) {
      cnt++;
    }
  }
  cout << (cnt%2 == 0 ? cnt/2 : cnt/2 + 1) << endl;
  return 0;
}
