#include <bits/stdc++.h>
using namespace std;
int parent[100000 + 435];
int size[100000 + 435];
int root(int x) {
  while (parent[x] != parent[parent[x]]) {
    parent[x] = parent[parent[x]];
    x = parent[x];
  }
  return x;
}
void uni(int a, int b) {
  int ra, rb;
  ra = root(a);
  rb = root(b);
  if (ra == rb) {
    return;
  }
  if (size[ra] < size[rb]) {
    size[rb] += size[ra];
    parent[ra] = rb;
  } else {
    size[ra] += size[rb];
    parent[rb] = ra;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, x;
  set<int> st;
  int count = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x == i) {
      count++;
    } else {
      st.insert(x);
    }
  }
  cout << count + (st.size() / 2);
  return 0;
}
