#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
T amax(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
void Chaliye_Shuru_Karte_Hai() {
  long long n;
  cin >> n;
  set<long long> s;
  long long ct = 0;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    if (a == i + 1) ct++;
    s.insert(a);
  }
  cout << (s.size() + ct) / 2;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tc = 1;
  while (tc--) {
    Chaliye_Shuru_Karte_Hai();
  }
}
