from collections import Counter





def solve(n, aaa):

    if all(a == 0 for a in aaa):

        return True



    if n % 3 != 0:

        return False



    cnt = list(Counter(aaa).items())

    if len(cnt) == 2:

        (a1, c1), (a2, c2) = cnt

        if c1 > c2:

            c1, c2 = c2, c1

        if c1 != n // 3 or c2 != n * 2 // 3:

            return False

        return a1 == 0



    if len(cnt) == 3:

        if any(c[1] != n // 3 for c in cnt):

            return False

        a1, a2, a3 = (c[0] for c in cnt)

        return a1 ^ a2 == a3



    return False





n = int(eval(input()))

aaa = list(map(int, input().split()))

print(('Yes' if solve(n, aaa) else 'No'))

from collections import Counter





def solve(n, aaa):

    if all(a == 0 for a in aaa):

        return True



    if n % 3 != 0:

        return False



    cnt = Counter(aaa)

    if len(cnt) == 2:

        (a1, c1), (a2, c2) = cnt.most_common()

        if c1 != n * 2 // 3 or c2 != n // 3:

            return False

        return a2 == 0



    if len(cnt) == 3:

        if any(c != n // 3 for c in list(cnt.values())):

            return False

        a1, a2, a3 = list(cnt.keys())

        return a1 ^ a2 == a3



    return False





n = int(eval(input()))

aaa = list(map(int, input().split()))

print(('Yes' if solve(n, aaa) else 'No'))

from collections import Counter


def solve(n, aaa):
    if all(a == 0 for a in aaa):
        return True
    if n % 3 != 0:
        return False
    cnt = list(Counter(aaa).items())
    if len(cnt) == 2:
        (a1, c1), (a2, c2) = cnt
        if c1 > c2:
            c1, c2 = c2, c1
        if c1 != n // 3 or c2 != n * 2 // 3:
            return False
        return a1 == 0
    if len(cnt) == 3:
        if any(c[1] != n // 3 for c in cnt):
            return False
        a1, a2, a3 = (c[0] for c in cnt)
        return a1 ^ a2 == a3
    return False


n = int(eval(input()))
aaa = list(map(int, input().split()))
print(("Yes" if solve(n, aaa) else "No"))

from collections import Counter


def solve(n, aaa):
    if all(a == 0 for a in aaa):
        return True
    if n % 3 != 0:
        return False
    cnt = Counter(aaa)
    if len(cnt) == 2:
        (a1, c1), (a2, c2) = cnt.most_common()
        if c1 != n * 2 // 3 or c2 != n // 3:
            return False
        return a2 == 0
    if len(cnt) == 3:
        if any(c != n // 3 for c in list(cnt.values())):
            return False
        a1, a2, a3 = list(cnt.keys())
        return a1 ^ a2 == a3
    return False


n = int(eval(input()))
aaa = list(map(int, input().split()))
print(("Yes" if solve(n, aaa) else "No"))

-    cnt = list(Counter(aaa).items()) +    cnt = Counter(aaa) -        (a1, c1), (a2, c2) = cnt -        if c1 > c2: -            c1, c2 = c2, c1 -        if c1 != n // 3 or c2 != n * 2 // 3: +        (a1, c1), (a2, c2) = cnt.most_common() +        if c1 != n * 2 // 3 or c2 != n // 3: -        return a1 == 0 +        return a2 == 0 -        if any(c[1] != n // 3 for c in cnt): +        if any(c != n // 3 for c in list(cnt.values())): -        a1, a2, a3 = (c[0] for c in cnt) +        a1, a2, a3 = list(cnt.keys())