N = int(input())
A = list(map(int, input().split()))
A.sort()

ans = "No"
B = list(set(A))
if B[0] == 0 and len(B) == 1:
    ans = "Yes"
elif N % 3 != 0:
    pass
else:
    if len(B) != 3:
        pass
    else:
        
        if B.count(B[0]) == B.count(B[1]) and B.count(B[0]) == B.count(B[2]):
            C = [0] * 3
            C[2] = format(B[2], 'b')
            M = len(C[2])
            C[0] = format(B[0], 'b')
            C[1] = format(B[1], 'b')
            S = ["000", "011", "101", "110"]
            
            if len(C[1]) == M and len(C[0]) < M:
                cnt  = 0
                while len(C[0]) < M:
                    C[0] = "0" + C[0]
                    cnt += 1
                for i in range(M):
                    ans = "Yes"
                    now = C[2][i] + C[1][i]
                    if C[0][i] == "b":
                        now = now + "0"
                    else:
                        now += C[0][i]
                    if now in S:
                        pass
                    else:
                        ans = "No"
                        break
            
        
print(ans)











            
