#include <bits/stdc++.h>
using namespace std;
int f[100010] = {0}, n, a[100010] = {0};
int find(int x) {
  if (f[x] == x)
    return x;
  else
    return f[x] = find(f[x]);
}
void cmb(int a, int b) {
  a = find(a);
  b = find(b);
  if (a > b)
    f[a] = b;
  else
    f[b] = a;
}
void init(int n) {
  int i;
  for (i = 1; i <= n; i++) {
    f[i] = i;
  }
}
int acc() {
  int i, sum = 0;
  for (i = 1; i <= n; i++) {
    if (f[i] == i) sum++;
  }
  return sum;
}
int main() {
  cin >> n;
  init(n);
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    cmb(i, t);
  }
  cout << acc() << endl;
  return 0;
}
