#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g(100000);
int vis[100001] = {0};
void dfs(int i) {
  vis[i]++;
  int sx = g[i].size();
  for (int k = 0; k < sx; k++) {
    if (!vis[g[i][k]]) dfs(g[i][k]);
  }
}
int main() {
  long long int n, count = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    g[i + 1].push_back(a);
    g[a].push_back(i + 1);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      count++;
      dfs(i);
    }
  }
  cout << count << "\n";
  return 0;
}
