from collections import Counter
N = int(input())
a = list(map(int,input().split()))
C = Counter(a)
if C[0] == N:
    print("Yes")
elif len(C) != 3 or N%3 != 0:
    print("No")
else:
    for e in C:
        if C[e] != N//3:
            print("No")
            exit(0)
    C = list(set(C))
    if C[0]^C[1] == C[2] or C[1]^C[2] == C[0] or C[2]^C[0] == C[1]:
        print("Yes")
    else:
        print("No")
