fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aArray = readLine()!!.split(" ").map { it.toInt() }
    for (i in 1 until n-1) {
        if (aArray[i - 1] xor aArray[i + 1] != aArray[i]) {
            print("No")
            return
        }
    }
    if (aArray[n-2] xor aArray[0] == aArray[n-1]) print("Yes")
    else print("No")
}