#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define INF 0x3f3f3f3f
#define PII pair<int,int>
const int MAX = 10005;
int N,A[MAX],weizhi[MAX],ans=0;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>N;
for(int i=1; i<=N; i++) {
cin>>A[i];
weizhi[A[i]] = i;
}
for(int i=1; i<=N; i++) {
if(weizhi[i]!=i) {
A[weizhi[i]] = A[i];
weizhi[A[i]] = weizhi[i];
A[i] = i;
weizhi[i] = i;
ans++;
}
}
cout<<ans;
return 0;
}