#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, cnt = 0; cin >> n; vector p(n+1); for(int i = 1; i <= n; i++) cin >> p[i]; for(int i = n; i >= 1; i--){ if(i != p[i]){ swap(p[i], p[p[i]]); cnt++; } } cout << cnt << '\n'; return 0; }