import sys import numpy as np def main(): n = int(input()) P = np.fromstring(input(), np.int64, sep=' ') - 1 ans = 0 for i in range(n): if P[i] == i: continue j, = np.nonzero(P == i) P[i], P[j] = P[j], P[i] ans += 1 print(ans) if __name__ == '__main__': main()