#include <bits/stdc++.h>
using namespace std;
int par[10010];
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    par[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    par[i] = min(a[i], par[a[i]]);
    par[a[i]] = min(a[i], par[a[i]]);
  }
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (par[i] == i) {
      count++;
    }
  }
  cout << count;
  return 0;
}
