import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    println(problem035a(n, a))
}

fun problem035a(n: Int, a: List<Long>): String {
    for (s in 0 until n) {
        for (i in 0 until s) {
            val prev = if (i == 0) a[n - 1] else a[i - 1]
            val next = if (i == n - 1) a[0] else a[i + 1]
            val ai = a[i]
            if (ai != prev xor next) return "No"
        }
        for (i in s until n) {
            val prev = if (i == 0) a[n - 1] else a[i - 1]
            val next = if (i == n - 1) a[0] else a[i + 1]
            val ai = a[i]
            if (ai != prev xor next) return "No"
        }
    }

    return "Yes"
}