from collections import Counter



N = int(eval(input()))

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

c = Counter(a)

used = set(c.keys())

size = len(used)



def check():

    if 0 in used:

        if size==1 or (size==2 and c[0]==N//3):

            return True

    elif size==3:

        s, t, u = used

        if s^t^u==0 and c[s]==c[t]==c[u]:

            return True

    return False



print(("Yes" if check() else "No"))
from collections import Counter



N = int(eval(input()))

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

c = Counter(a)

b = len(list(c.keys()))



def check():

    if 0 in list(c.keys()):

        if b==1 or (b==2 and c[0]==N//3):

            return True

    elif b==3:

        s, t, u = list(c.keys())

        if s^t^u==0 and c[s]==c[t]==c[u]:

            return True

    return False



print(("Yes" if check() else "No"))
from collections import Counter

N = int(eval(input()))
(*a,) = list(map(int, input().split()))
c = Counter(a)
used = set(c.keys())
size = len(used)


def check():
    if 0 in used:
        if size == 1 or (size == 2 and c[0] == N // 3):
            return True
    elif size == 3:
        s, t, u = used
        if s ^ t ^ u == 0 and c[s] == c[t] == c[u]:
            return True
    return False


print(("Yes" if check() else "No"))

from collections import Counter

N = int(eval(input()))
(*a,) = list(map(int, input().split()))
c = Counter(a)
b = len(list(c.keys()))


def check():
    if 0 in list(c.keys()):
        if b == 1 or (b == 2 and c[0] == N // 3):
            return True
    elif b == 3:
        s, t, u = list(c.keys())
        if s ^ t ^ u == 0 and c[s] == c[t] == c[u]:
            return True
    return False


print(("Yes" if check() else "No"))

-used = set(c.keys()) -size = len(used) +b = len(list(c.keys())) -    if 0 in used: -        if size == 1 or (size == 2 and c[0] == N // 3): +    if 0 in list(c.keys()): +        if b == 1 or (b == 2 and c[0] == N // 3): -    elif size == 3: -        s, t, u = used +    elif b == 3: +        s, t, u = list(c.keys())