#include <bits/stdc++.h>
using namespace std;
int in[100005];
int fin(int a) {
  if (a == in[a]) return a;
  return in[a] = fin(in[a]);
}
int merg(int a, int b) {
  if (fin(a) == fin(b)) return 0;
  in[a] = in[b];
  return -1;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) in[i] = i;
  int ans = n;
  for (int i = 1; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    ans += merg(i, a);
  }
  cout << ans << endl;
  return 0;
}
