N = int(input())
a = input().split(" ")
a_int = list(map(int,a))

n = N - 1
x = a_int[0]
y = a_int[1]
z = a_int[2]
while bin(x ^ z) == bin(y):
	if z < a_int[n]:
		x = a_int[0 + 1]
		y = a_int[1 + 1]
		z = a_int[2 + 1]
	else:
		print("Yes")
		break
if z == a_int[n]:
	pass
else:
	print("No")