#include <bits/stdc++.h>
using namespace std;
int f[10001] = {0};
int father(int a) {
  if (f[a]) {
    f[a] = father(f[a]);
    return f[a];
  } else {
    return a;
  }
}
int add(int a, int b) {
  int fa = father(a);
  int fb = father(b);
  if (fa != fb) {
    f[fa] = fb;
    return 1;
  } else {
    return 0;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int ans = n;
  for (int i = 1; i <= n; ++i) {
    int t;
    scanf("%d", &t);
    ans -= add(i, t);
  }
  printf("%d\n", ans);
  return 0;
}
