n=int(input())
a=list(map(int,input().split()))
f = a[n-1]
a.append(a[0])
check=0
for i in range(n):
    if a[i] == f^a[i+1]:
        f=a[i]
    else:
        check=1
        break
if check ==0:
    print('Yes')
else:
    print('No')
