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))
    if len(sets) != 3:
        print("No")
        exit()

    for s in sets:
        if a.count(s) != n:
            print("No")
            exit()

    order = max(a).bit_length()

    for i in range(order):
        b = [sets[0] >> i & 1, sets[1] >> i & 1, sets[2] >> i & 1]
        if not equal_list(b, [0, 1, 1]):
            print("No")
            exit()

    print("Yes")

else:
    print("No")
    exit()
