from collections import Counter

N= int(input())

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

x = Counter(a)

ok = False
if len(x) == 3:
    for i in a:
        if x[i] != len(x) // 3:
            break
    else:
        ok = True
elif len(x) == 1:
    if x.get(0) is not None:
        ok = True

if ok:
    print("Yes")
else:
    print("No")
