#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long int t, count, n, i, x;
  long long int a[100010];
  cin >> n;
  count = 0;
  t = 0;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x == i)
      t += 1;
    else {
      if (!a[x]) {
        a[x] = 1;
        count += 1;
      }
    }
  }
  cout << t + count / 2 << endl;
}
