fun main(args: Array<String>) {
    agc035a()
}

fun agc035a() {
    readLine()!!.toInt() // rip n
    val aList = readLine()!!.split(" ").map { it.toLong() }.toLongArray()

    val answer = aList.withIndex().all { iv ->
        val (index, a) = iv
        val left = if (index == 0) aList.last() else aList[index - 1]
        val right = if (index == aList.lastIndex) aList.first() else aList[index + 1]
        left xor right == a
    }.let { if (it) "Yes" else "No" }

    println(answer)
}
