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