import numpy as np
N = input()
a = input().split()
result = 0
a.extend(a)
for i in np.arange(int(N)):
    if (bin(int(a[i]) ^ int(a[i+2]))) == bin(int(a[i+1])):
        break
    else:
        result +=1
if(result==0):
    print('Yes')
else:
    print('No')