n = int(input())
a = list(map(int,input().split()))
L = [0]*(n+1)
for i in range(n):
    if i == 0:
        t = a[1]^a[-1]
    elif i == n-1:
        t = a[n-2]^a[0]
    else:
        t = a[i-1]^a[i+1]
    if 0 <= t <= n:
        L[t] += 1

sw = 1
for i in range(1,n+1):
    if L[i] != 1:
        sw = 0
        break
print(["No","Yes"][sw])