import sys

n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
n_bin = len(bin(max(a_ls))) - 2
a_ls = [bin(a)[2:].zfill(n_bin) for a in a_ls]
cnt = {i : 0 for i in range(n_bin)}
for a in a_ls:
    for i, _a in enumerate(a):
        cnt[i] += _a == "1"
flg = True
if sum(cnt.values()) == 0:
    print("Yes")
elif n % 3 != 0:
    print("No")
else:
    for i in range(n_bin):
        flg &= cnt[i] == n // 3 * 2
        if not flg:
            break
    if flg:
        print("Yes")
    else:
        print("No")