#!/usr/bin/env python3 import functools import operator N = int(input()) a = [0] + list(map(int, input().split())) rest = list(range(len(a))) loop = [] while True: if len(rest) == 0: break now = rest[0] count = 0 while True: rest.remove(now) now = a[now] if now not in rest: loop.append(count) break count += 1 if len(list(filter(lambda x: x % 2 != 0, loop))) == 0: print("Yes") else: print("No")