import collections

YES="Yes"
NO="No"

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

c = collections.Counter(a)
l_c = len(c)
if l_c == 1:
    if c[0] == N:
        print(YES)
    else:
        print(NO)
elif l_c == 3:
    v = list(c.values())
    if v[0] == v[1] == v[2]:
        print(YES)
    else:
        print(NO)
else:
    print(NO)
