#include <bits/stdc++.h>
using namespace std;
int xd[] = {1, 0, -1, 0};
int yd[] = {0, -1, 0, 1};
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
inline bool isEqual(double x, double y) {
  const double epsilon = 1e-5;
  return abs(x - y) <= epsilon * abs(x);
}
long double triarea(long long x1, long long y1, long long x2, long long y2,
                    long long x3, long long y3) {
  return (long double)abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) /
         2.0;
}
bool triinside(long x1, long y1, long x2, long y2, long x3, long y3, long x,
               long y) {
  long area1 = triarea(x1, y1, x2, y2, x3, y3);
  long area2 = triarea(x, y, x2, y2, x3, y3);
  long area3 = triarea(x1, y1, x, y, x3, y3);
  long area4 = triarea(x1, y1, x2, y2, x, y);
  if (isEqual(area1, area2 + area3 + area4)) return true;
  return false;
}
long long dist(long long x1, long long y1, long long x2, long long y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
const double pi = acos(-1.0);
long double todegree(long double radian) {
  if (radian < 0) radian += 2 * pi;
  return radian * 180 / pi;
}
long double toradian(long double degree) { return degree * pi / 180.0; }
long long poww(long long a, int b) {
  long long ret = 1;
  for (int i = 0; i < b; i++) ret *= a;
  return ret;
}
long long sumOfNumbers(long long num) {
  long long ret = 0;
  while (num) {
    ret += num % 10;
    num /= 10;
  }
  return ret;
}
unsigned long long fact(unsigned long long n) {
  unsigned long long sum = 1;
  while (n > 1) {
    sum *= n;
    n--;
  }
  return sum;
}
unsigned long long combination(unsigned long long a, unsigned long long b) {
  long long ret = 1;
  for (int i = 0; i < b; i++) ret = ret * (a - i) / (i + 1);
  return ret;
}
bool v[100005];
vector<vector<int>> g(100005);
vector<int> vo;
void dfs(int node) {
  v[node] = true;
  for (auto child : g[node]) {
    if (!v[child]) dfs(child);
  }
}
int main() {
  std::ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    int o;
    cin >> o;
    g[i + 1].push_back(o);
    g[o].push_back(i + 1);
    vo.push_back(o);
  }
  int ans = 0;
  for (int i = 1; i <= (int)(n); ++i) {
    if (!v[vo[i - 1]]) {
      dfs(vo[i - 1]);
      ans++;
    }
  }
  cout << ans;
  return 0;
}
