#Xor circle
n=int(input())
lists=list(map(int,input().split()))
import collections
d=dict(collections.Counter(lists))
if len(d)<=3:
    flag=True
    for key,value in d.items():
        if value<n//3:
            flag=False
            break
    if flag:
        print("Yes")
    else:
        print("No")
else:
    print("No")