import sys

N = int(input())
a = input().split()

#print(N)
#print(a)

for i in range(N):
	x = int(a[(i-1)%N])
	y = int(a[(i+1)%N])
'''
	print(i+1)
	print('↓')
	print(x, y)
	print('↓')
	print(x ^ y) 
	print(a[i%N])
'''
	if int(a[i%N]) != x^y:
		print('No')
		sys.exit(0);

print('Yes')
