fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map(String::toInt)
    if (n % 3 != 0) {
        if (a.all { it == 0 }) {
            println("Yes")
        } else {
            println("No")
        }
    } else {
        val po = a.groupBy { it }.map { Pair(it.key, it.value.size )}
        if (po.size != 3 || !(po[0].second == po[1].second && po[2].second == po[1].second && po[0].second == po[2].second)) {
            if (po.size == 2 && (po[0].second == po[1].second * 2 || po[1].second == po[0].second * 2)) {
                println("Yes")
            } else {
                println("No")
            }
        } else {
            if (po[0].first xor po[1].first == po[2].first) {
                println("Yes")
            } else {
                println("No")
            }
        }
    }
}
