import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines """ ・巡回置換の長さ ・2n+1 -> 2n+1 ・2n -> n, n ・結局、偶数は同数ずつないといけないというのが条件 """ N,*A = map(int,read().split()) A = [0] + A period = [0] * (N+1) for i,x in enumerate(A): p = 0 y = x while True: y = A[y] p += 1 if y == x: break period[i] = p counter = [0] * (N+10) for x in period[1:]: counter[x] += 1 answer = 'Yes' for i in range(0,N+10,2): if counter[i] % 2 != 0: answer = 'No' print(answer)