import math

n = int(input())
inp = [int(x) for x in input().split()]
m = max(inp)
a = [format(x, '0' + str(len(str(format(m, 'b')))) + 'b') for x in inp]

def mk_pair(f):
    s11, s12 = '', ''
    s21, s22 = '', ''
    for c in f:
        cn = '1' if c == '0' else '0'
        s11 += c
        s12 += c if c == '0' else cn
        s21 += cn
        s22 += cn if c == '0' else c
    return (s11, s12), (s21, s22)

def axor(p1, p2):
    res = ''
    for c1, c2 in zip(p1, p2):
        res += '0' if c1 == c2 else '1'
    return res

def check(a, p, first):
    sa = set(a)
    sa.discard(first)
    p1, p2 = p

    q1 = first
    q2 = first

    c1 = p1
    c2 = p2

    rest = len(sa)
    while True:
        n1 = axor(q1, c1)
        n2 = axor(q2, c2)
        if (n1 == n2 and n1 in sa and rest == 1):
            return True
        if (n1 in sa and n2 in sa):
            rest -= 2
            if (rest == 0):
                return (
                    (n2 == axor(c1, n1) and n1 == axor(c2, n2))
                    or (n1 == c2 and n2 == c1))
            sa.discard(n1)
            sa.discard(n2)
            q1 = c1
            q2 = c2
            c1 = n1
            c2 = n2
        else:
            return False

for p in mk_pair(a[0]):
    ans = check(a, p, a[0])
    if ans:
        print('Yes')
        break
else:
    print('No')
