#include <bits/stdc++.h>
using namespace std;
void merge(int x, int y, vector<int> &ball) {
  int rep = ball[x];
  int to = ball[y];
  for (int i = 0; i < ball.size(); i++) {
    if (ball[i] == rep) {
      ball[i] = to;
    }
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> ball(n);
  for (int i = 0; i < n; i++) ball[i] = i;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    t--;
    merge(i, t, ball);
  }
  vector<bool> vis(n);
  int ret = 0;
  for (int i = 0; i < n; i++) {
    vis[ball[i]] = true;
  }
  for (int i = 0; i < n; i++) {
    ret += vis[i];
  }
  cout << ret << endl;
  return 0;
}
