N = int(input()) lsa = list(map(int,input().split())) used = [False]*(N) so = [0]*(N) for i in range(N): so[lsa[i]-1] = i ans = 0 for i in range(N): if used[so[i]]: continue used[so[i]] = True if so[i] != 0: used[so[i]-1] = True ans += 1 print(ans)