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