#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
int g[10001];
int find_set(int x) {
  if (x == g[x]) return x;
  return g[x] = find_set(g[x]);
}
void union_sets(int x, int y) {
  x = find_set(x);
  y = find_set(y);
  if (x != y) g[y] = x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n, ans = 0, k, c = 0, m = 0, flag = 0;
    cin >> n;
    int a[n + 1];
    set<int> s;
    for (int i = (1); i < (n + 1); i++) {
      cin >> a[i];
      if (a[i] == i)
        c++;
      else
        s.insert(a[i]);
    }
    c += s.size() / 2;
    cout << c << endl;
  }
  return 0;
}
