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

if all(i == 0 for i in a):
    print('Yes')
    exit()

p = n // 3
if n % 3 != 0:
    print('No')
    exit()

if 0 in a:
    a = sorted(a)
    zero = a.count(0)
    if zero != p:
        print('No')
        exit()
    if a[p] != a[-1]:
        print('No')
        exit()
    print('Yes')
    exit()

a = sorted(a)
if a.count(a[0]) != p or a.count(a[p]) != p or a.count(a[-1]) != p:
    print('No')
else:
    print('Yes')
