fun main(args: Array<String>) {
    val N  = nextInt()
    val A = listOfInt()
    val zeros = A.count { it == 0 }
    if (zeros == N) {
        println("Yes")
        return
    } else if (N % 3 != 0) {
        println("No")
        return
    }

    var M = mutableMapOf<Int, Int>()
    A.forEach {
        val n = M.get(it) ?: 0
        M.put(it, n + 1)
    }
    if (M.count() == 3) println("Yes")
    else println("No")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
