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

from collections import Counter

c=Counter(a)

if len(list(c.keys())) ==3:
    if list(c.values())==[n//3,n//3,n//3]:
        print('Yes')
elif len(list(c.keys()))==2:
    if c.most_common()[0][1]==2*n//3:
        print('Yes')
elif len(list(c.keys()))==1:
    if c.keys()[0]==0:
        print('Yes')
else:
    print('No')