#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
int a[N], ans;
bool h[N];
vector<int> v[N];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    v[a[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (!h[i]) {
      ans++;
      int x = a[i];
      int y = a[x];
      for (auto p : v[x]) h[p] = 1;
      for (auto p : v[y]) h[p] = 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
