n=int(input())
a=list(input().split())
A=a.count(a[0])
ans="Yes"
if n%3==0 and n!=3:
    for i in range(n):
        if a.count(a[i])!=A or a.count(a[i])==1:
            ans="No"
            break
print(ans)