n = int(input()) *r, = map(int,input().split()) for i in range(n): r[i] -= 1 from collections import Counter d = Counter() used = [0]*n for i in range(n): if used[i]: continue cnt = 0 while used[i]==0: used[i] = 1 i = r[i] cnt += 1 d[cnt] += 1 print("No" if any(k%2==0 and v%2==1 for k,v in d.items()) else "Yes")