n = int(input())
a = list(map(int,input().split()))
a1 = []
for i in range(n):
    if a[i] in a1:
        a1 = a1
    else:
        a1.append(a[i])
ans = "Yes"
if n%3 == 0:
    if len(a1) == 3:
        p = list(format(a1[0],"b"))
        q = list(format(a1[1],"b"))
        r = list(format(a1[2],"b"))
        s = max(len(p),len(q),len(r))
        if s != len(p):
            p.reverse()
            for i in range(s-len(p)):
                p.append(0)
            p.reverse()
        if s != len(q):
            q.reverse()
            for i in range(s-len(q)):
                q.append(0)
            q.reverse()
        if s != len(r):
            r.reverse()
            for i in range(s-len(r)):
                r.append(0)
            r.reverse()
        for i in range(s):
            x = [int(p[i]),int(q[i]),int(r[i])]
            x.sort()
            if x == [0,0,0] or x == [0,1,1]:
                ans = ans
            else:
                ans = "No"
        print(ans)
    elif len(a1) == 2:
        if a1[0] == 0:
            print(ans)
        else:
            print("No")
    elif len(a1) == 1:
        if a1[0] == 0:
            print(ans)
        else:
            print("No")
    else:
        print("No")
else:
    if a1 == [0]:
        print(ans)
    else:
        print("No")