fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    if(a.all { it==0 }){
        println("Yes")
    }else if(n%3==0 && a.groupBy { it }.map { it.value.size }.all { it==n/3 }){
        println("Yes")
    }else {
        println("No")

    }
}
