import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

enum class Op(val i: Int, val op: String) {
    Plus(1, "+"),
    Minus(-1, "-")
}

fun solve() {
    // a b c d e f g h
    // b = a ^ c
    // c = b ^ d
    // d = c ^ e
    // e = d ^ f

    // b = a ^ b ^ d
    // 0 = a ^ d
    val n = readInteger()
    val aList = readIntegerList()
    for ((i, a) in aList.withIndex()) {
        if (a xor aList[(i + 3) % n] != 0) {
            out.println("No")
            return
        }
    }
    out.println("Yes")
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)
