n = int(input())
x = list(map(int, input().split()))

sum = 1

sum = sum * (x[0] == x[n-1] ^ x[1])
for i in range(1, (n-1 - 1 )):
    sum = sum * (x[i-1] ^ x[i+1])
sum = sum * (x[n-1] == x[0] ^ x[n-2])

if sum == 1:
    print("Yes")
else:
    print("No")