#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 6;
int par[N];
set<int> s;
int find(int x) {
  if (x == par[x]) return x;
  return par[x] = find(par[x]);
}
void join(int x, int y) {
  x = find(x);
  y = find(y);
  if (x != y) par[x] = y;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n + 2; i++) par[i] = i;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    join(min(x, i + 1), max(i + 1, x));
  }
  for (int i = 0; i < n; i++) {
    s.insert(find(i + 1));
  }
  cout << s.size();
}
