n = int(input()) a = list(map(int, input().split())) visited = [False] * (n + 1) cycle_lengths = [] for i in range(1, n + 1): if not visited[i]: length = 0 current = i while not visited[current]: visited[current] = True current = a[current - 1] # since a is 1-based in the problem description length += 1 cycle_lengths.append(length) from collections import defaultdict counter = defaultdict(int) for l in cycle_lengths: counter[l] += 1 possible = True for l in counter: if l % 2 == 0: if counter[l] % 2 != 0: possible = False break print("Yes" if possible else "No")