#include <bits/stdc++.h>
using namespace std;
bool visited[10000] = {0};
int main() {
  int n;
  cin >> n;
  int total = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    if (num != i + 1) {
      visited[num - 1] = 1;
    } else {
      total += 2;
    }
  }
  for (int i = 0; i < n; i++) {
    if (visited[i] == 1) {
      total++;
    }
  }
  cout << total / 2 << endl;
}
