from collections import Counter
from itertools import combinations
N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
if len(c) == 2 and c[0] == N//3:
    print('Yes')
elif len(c) == 3:
    x, y, z = c.keys()
    if x ^ y ^ z == 0 and any(x==y==N//3 for x, y in combinations(c.values(), 2)):
        print('Yes')
else:
    print('No')
