from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
count = Counter(a)
flag = False
if max(count.values())==n:
    flag = True
else:
    if count[0]==n//3 and max(count.values())==(n*2//3):
        flag = True
        
    else:
        flag = True
        for i in count:
            if count[i]!=n/3:
                flag = False
print('Yes' if flag==True else 'No')
        



    
        
    