import random
 
n = int(input())
a = [int(i) for i in input().split()]
 
rc = 0
while rc != 1000:
	c = 0
	for i in range(len(a)-1):
		if a[i] != int(bin(a[i-1]^a[i+1]),0):
			c=1
			random.shuffle(a)
			rc+=1
			break
	if c==0:
		if a[-1] != int(bin(a[0]^a[-2]),0):
			random.shuffle(a)
			rc+=1
		else:
			print("Yes")
			exit()
print("No")