inp = input()
n = int(inp)
inp = input()
split_inp = inp.split()
if n % 3 != 0:
    print("No")
    exit()
# 数字を3つのグループに分けていく．
# 3種類以上の数字があればno
numbers = {}
for str_number in split_inp:
    if str_number not in numbers:
        numbers[str_number] = 1
    else:
        numbers[str_number] += 1
    if len(numbers) > 3:
        print("No")
        exit()
if len(numbers) != 3:
    print("No")
    exit()
# 均等に3当分されている
number_list = [i for i in numbers.values()]
if number_list[0] != number_list[1] or number_list[1] != number_list[2]:
    print("No")
    exit()


def number_count(k1, k2, k3, count_n):
    count = 0
    if k1 == count_n:
        count += 1
    if k2 == count_n:
        count += 1
    if k3 == count_n:
        count += 1
    return count


# ビット列に同時に直す.下の桁から見ていき，0,1,1になっていなければno
n_list = [i for i in numbers.keys()]
n1 = int(n_list[0])
n2 = int(n_list[1])
n3 = int(n_list[2])
while n1 != 0 or n2 != 0 or n3 != 0:
    # 一番下の桁を取り出す
    c1 = n1 % 2
    c2 = n2 % 2
    c3 = n3 % 2
    n1 = n1 // 2
    n2 = n2 // 2
    n3 = n3 // 2
    # 1,1,0の組み合わせでなければno
    count1 = number_count(c1, c2, c3, 1)
    count0 = number_count(c1, c2, c3, 0)
    if count1 != 2 or count0 != 1:
        print("No")
        exit()
print("Yes")
