def equal_list(lst1, lst2):
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            break
    else:
        if not lst:
            return True
    return False


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

if a == [0]*N:
    print("Yes")
    exit()

if N % 3 == 0:
    n = N // 3
    sets = list(set(a))
    order = max(a).bit_length()
    if len(sets) == 3:
        for s in sets:
            if a.count(s) != n:
                print("No")
                exit()

        for i in range(order):
            b = [sets[0] >> i & 1, sets[1] >> i & 1, sets[2] >> i & 1]
            if b == [0, 0, 0]:
                continue
            if not equal_list(b, [0, 1, 1]):
                print("No")
                exit()
    elif len(sets) == 2:
        if a.count(sets[0]) == n:
            for i in range(order):
                b = [sets[0] >> i & 1, sets[1] >> i & 1]
                if b == [0, 0]:
                    continue
                if b != [0, 1]:
                    print("No")
                    exit()
        elif a.count(sets[1]) == n:
            for i in range(order):
                b = [sets[0] >> i & 1, sets[1] >> i & 1]
                if b == [0, 0]:
                    continue
                if b != [1, 0]:
                    print("No")
                    exit()
    else:
        print("No")
        exit()

    print("Yes")

else:
    print("No")
    exit()
