n = int(input())
l = list(map(int, input().split()))
if n % 3 != 0:
    print("No")
    quit()
d = {}
for i in l:
    if i in d.keys():
        d[i] += 1
    else:
        if len(d) == 3:
            print("No")
            quit()
        d[i] = 1
if len(d) > 3:
    print("No")
    quit()
a = l[0]
b = l[1]
e = {}
b = l[i]
c = a ^ b
e[a] = int(n / 3)
e[b] = int(n / 3 * (2 if b in e else 1))
e[c] = int(n / 3 if c not in e else e[c] + n / 3)
if (
        d[a] == e[a] and
        d[b] == e[b] and
        d[c] == e[c]
        ):
    print("Yes")
    quit()
print("No")
