from collections import Counter

n = int(input())
a = list(map(int, input().split()))

c = Counter(a)
l = len(set(a))

if l == 1 and a[0] == 0:
    print('Yes')
elif len(a) % 3 == 0:
    if l == 2 and c[0] == n // 3:
        print('Yes')
    elif l == 3:
        tmp = c[a[0]]
        if all(x == tmp for x in c.values()):
            print('Yes')
    else:
        print('No')
else:
    print('No')
