#include <iostream>
using namespace std;
#define maxN 10001
int nums[maxN] = {0};
int nums_2[maxN] = {0};
int N;
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
int main()
{
int count = 0;
cin >> N;
for (int i = 1; i <= N; i++)
{
cin >> nums_2[i];
nums[nums_2[i]] = i;
}
for (int i = 1; i <= N; i++)
{
if (i == nums[i])
continue;
else
{
count++;
swap(nums_2[nums[i]], nums_2[i]);
nums[nums_2[nums[i]]] = nums[i];
nums[i] = i;
}
}
cout << count;
}