# coding: Shift-Jis
 

N = int(input())
a =[]
if N < 3:
	print("No")
	exit()

for i in input().split():
	a.append(int(i))

for i in range(N-2):
	if a[i] ^ a[i+2] != a[i+1]:
		print("No")
		exit()

if a[N-2] ^ a[0] != a[N-1]:
	print("No")
	exit()
if a[N-1] ^ a[1] != a[0]:
	print("No")
	exit()



print("Yes")
