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

if max(a) == 0:
    print('Yes')
    exit()

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

p = n // 3
if 0 in a:
    # a = sorted(a)
    zero = a.count(0)
    if zero != p:
        print('No')
        exit()
    if a.count(max(a)) != p * 2:
        print('No')
        exit()
    print('Yes')
    exit()

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