n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
    if i in d:
        d[i] += 1
    else:
        if len(d) == 3:
            print("No")
            quit()
        d[i] = 1
a = l[0]
b = l[1]
c = a ^ b
e = {}
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 a == b and b == c:
    if d[a] == n:
        print("Yes")
        quit()
    else:
        print("No")
        quit()
if a not in d or b not in d or c not in d:
    print("No")
    quit()
if d[a] == e[a] and d[b] == e[b] and d[c] == e[c]:
    print("Yes")
    quit()
print("No")
