N = int(input())
r = list(map(int,input().rstrip().split(' ')))
f = 0
if (r[1] ^ r[N-1]) == r[0]:
    f += 1
for i in range(1,N-1):
    if (r[i-1] ^ r[i+1]) == r[i]:
        f += 1
if (r[0] ^ r[N-2]) == r[N-1]:
    f += 1
if f == N:
    print("Yes")
else:
    print("No")