from bisect import bisect_left, bisect_right; from collections import Counter, defaultdict, deque, OrderedDict; from copy import deepcopy; from fractions import gcd; from functools import lru_cache, reduce; from math import ceil, floor; from sys import stdin, setrecursionlimit
import heapq as hq; import itertools as its; import operator as op


# globals
inf = float('inf')
input = stdin.readline


def main():
    n = get_int()
    A = get_li()
    if n % 3 != 0:
        if any(a != 0 for a in A):
            print('No')
            return
    else:
        cnt = Counter(A)
        if len(cnt.items()) > 3:
            print('No')
            return
        elif len(cnt.items()) == 3:
            a, b, c = cnt.most_common(3)
            if a[0] ^ b[0] ^ c[0] != 0:
                print('No')
                return
        elif len(cnt.items()) == 2:
            a, b = cnt.most_common(2)
            if b[0] != 0:
                print('No')
                return
        else:
            a = cnt.most_common(1)[0]
            if a[0] != 0:
                print(a)
                print('No')
                return
        for v, c in cnt.items():
            if c % (n // 3) != 0:
                print('No')
                return
    print('Yes')
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def gets(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    setrecursionlimit(4100000)
    main()
