#include <bits/stdc++.h>
using namespace std;
const int MAX = (long long)1e5;
const long long rem = (long long)1e9 + 7;
vector<bool> Sieve() {
  vector<bool> hash(MAX + 1, true);
  for (int i = 2; i * i < MAX + 1; i++) {
    if (!hash[i]) continue;
    for (int j = i * i; j < MAX + 1; j += i) {
      hash[j] = false;
    }
  }
  return hash;
}
int n;
int m;
int t;
int k;
int a;
vector<bool> seen(10001);
int b, c, d;
int cnt;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (seen[arr[i]]) continue;
    bool isTrue = false;
    int tmp = arr[i];
    while (!seen[tmp]) {
      seen[tmp] = true;
      tmp = arr[tmp];
    }
    cnt++;
  }
  cout << cnt;
  return 0;
}
