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

end_frg = 0
ans = 'No'

if sum(a) == 0:
    end_frg = 1

if end_frg == 0:
    if a.count(0) == n/3 and len(set(a)) == 2:
        end_frg = 1

if end_frg == 0:
    if len(set(a)) == 3:
        a0, a1, a2 = set(a)
        if bin(a0 ^ a1 ^ a2) == 0:
            if a.count(a0)==a.count(a1)==a.count(a2):
                end_frg = 1

if end_frg == 1:
    ans = 'Yes'

print(ans)
