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

import collections
c = collections.Counter(a)
unique = list(set(a))

from operator import xor
v = []
for k in c.keys():
    v.append(c[k])
v.sort()

flag = False
if n % 3 == 0:
    if len(v) == 1:
        if v == [n]:
            flag = True
    elif len(v) == 2:
        if v == [n // 3, n // 3 * 2]:
            if c[unique[0]] == n // 3:
                if xor(unique[1], unique[0]) == unique[1] and xor(unique[1], unique[1]) == unique[0]:
                    flag = True
            else:
                if xor(unique[0], unique[1]) == unique[0] and xor(unique[0], unique[0]) == unique[1]:
                    flag = True
    elif len(v) == 3:
        if v == [n // 3, n // 3, n // 3]:
            if xor(unique[0], unique[1]) == unique[2] and xor(unique[1], unique[2]) == unique[0] and xor(unique[2], unique[0]) == unique[1]:
                flag = True
else:
    if v == [n]:
        flag = True

if flag:
    print('Yes')
else:
    print('No')
