object Main {
  def main(args: Array[String]) = {

    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    val I = List.fill(N)(sc.nextInt)
    sc.close()

    if (N % 3 != 0) {
      println("No")
    } else {
      val aa = I(0) ^ I(1)
      val ret = (0 until N / 3).forall(i => I(2 + i * 3) == aa)
      ret match {
        case true => println("Yes")
        case _    => println("No")
      }
    }
  }
}