parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=parseMap(split(readline()))
    cnt=Dict{Int,Int}()
    for i in a
        if haskey(cnt,i)
            cnt[i]+=1
        else
            cnt[i]=1
        end
    end
    ans="No"
  	k=collect(keys(cnt))
    if (length(cnt)==1 && cnt[0]==n) || (length(cnt)==2 && cnt[0]==n÷3) || (length(cnt)==3 && k[1] $ k[2] $ k[3]==0)
        ans="Yes"
    end
    println(ans)
end
main()