from collections import defaultdict



n = int(eval(input()))

a = tuple(map(int, input().split()))



can = True

if n % 3 == 0:

    d = defaultdict(int)

    for aa in a:

        d[aa] += 1

    m = n // 3



    t = []

    for number, cnt in list(d.items()):

        if cnt % m != 0:

            can = False

            break

        else:

            for _ in range(cnt // m):

                t.append(number)

    else:

        if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)):

            can = False



else:

    if any(aa != 0 for aa in a):

        can = False



print(('Yes' if can else 'No'))
def main():

    from collections import Counter



    n = int(eval(input()))

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



    if n % 3 == 0:

        ctr = Counter(a)

        if len(ctr) == 1:

            print(('Yes' if 0 in ctr else 'No'))

            return



        elif len(ctr) == 2:

            print(('Yes' if ctr[0] == n // 3 else 'No'))

            return



        elif len(ctr) == 3:

            x = 0

            p = None

            for k, v in list(ctr.items()):

                if p is None:

                    p = v

                elif p != v:

                    print('No')

                    return

                x ^= k

            print(('Yes' if x == 0 else 'No'))

            return



        else:

            print('No')

            return



    else:

        print(('Yes' if all([x == 0 for x in a]) else 'No'))

        return





if __name__ == '__main__':

    main()

from collections import defaultdict

n = int(eval(input()))
a = tuple(map(int, input().split()))
can = True
if n % 3 == 0:
    d = defaultdict(int)
    for aa in a:
        d[aa] += 1
    m = n // 3
    t = []
    for number, cnt in list(d.items()):
        if cnt % m != 0:
            can = False
            break
        else:
            for _ in range(cnt // m):
                t.append(number)
    else:
        if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)):
            can = False
else:
    if any(aa != 0 for aa in a):
        can = False
print(("Yes" if can else "No"))

def main():
    from collections import Counter

    n = int(eval(input()))
    (*a,) = list(map(int, input().split()))
    if n % 3 == 0:
        ctr = Counter(a)
        if len(ctr) == 1:
            print(("Yes" if 0 in ctr else "No"))
            return
        elif len(ctr) == 2:
            print(("Yes" if ctr[0] == n // 3 else "No"))
            return
        elif len(ctr) == 3:
            x = 0
            p = None
            for k, v in list(ctr.items()):
                if p is None:
                    p = v
                elif p != v:
                    print("No")
                    return
                x ^= k
            print(("Yes" if x == 0 else "No"))
            return
        else:
            print("No")
            return
    else:
        print(("Yes" if all([x == 0 for x in a]) else "No"))
        return


if __name__ == "__main__":
    main()

-from collections import defaultdict +def main(): +    from collections import Counter -n = int(eval(input())) -a = tuple(map(int, input().split())) -can = True -if n % 3 == 0: -    d = defaultdict(int) -    for aa in a: -        d[aa] += 1 -    m = n // 3 -    t = [] -    for number, cnt in list(d.items()): -        if cnt % m != 0: -            can = False -            break +    n = int(eval(input())) +    (*a,) = list(map(int, input().split())) +    if n % 3 == 0: +        ctr = Counter(a) +        if len(ctr) == 1: +            print(("Yes" if 0 in ctr else "No")) +            return +        elif len(ctr) == 2: +            print(("Yes" if ctr[0] == n // 3 else "No")) +            return +        elif len(ctr) == 3: +            x = 0 +            p = None +            for k, v in list(ctr.items()): +                if p is None: +                    p = v +                elif p != v: +                    print("No") +                    return +                x ^= k +            print(("Yes" if x == 0 else "No")) +            return -            for _ in range(cnt // m): -                t.append(number) +            print("No") +            return -        if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)): -            can = False -else: -    if any(aa != 0 for aa in a): -        can = False -print(("Yes" if can else "No")) +        print(("Yes" if all([x == 0 for x in a]) else "No")) +        return + + +if __name__ == "__main__": +    main()