import sys

n = int(input())
a = list(map(int, input().split( )))
#一意に決まるので試してしまう
b = [a[(i+1)%n]^a[(i-1+n)%n] for i in range(n)]

for i in range(n):
    if b[i]!=a[i]:
        print("No")
        sys.exit()

print("Yes")