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

if N % 3:
    ans = len(set(A)) == 1
else:
    c = Counter(A)
    if len(c) != 3:
        ans = False
    else:
        x, y, z = c.keys()
        ans = (x | y == z)
print('Yes' if ans else 'No')
