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