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

ans = 'No'
if N%3 == 0:
    hat1 = max(a)
    hat2 = min(a)
    if hat1 == 0 & a.count(0) == N:
        ans = 'Yes'
    if a.count(hat1) == int(N/3) & a.count(hat2) == int(N/3) & a.count(hat1^hat2) == int(N/3):
        ans = 'Yes'

print(ans)
