package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	stdin.Scan()
	N, _ := strconv.Atoi(stdin.Text())
	stdin.Scan()
	hats := make([]int, N)
	for i, istr := range strings.Split(stdin.Text(), " ") {
		hats[i], _ = strconv.Atoi(istr)
	}
	t := []int{}
	if perm(t, hats) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func perm(head []int, rest []int) bool {
	if len(rest) == 0 {
		b := false
		N := len(head)
		for i := 0; i < N; i++ {
			if head[(N+i-1)%N]^head[(N+i+1)%N] == head[(N+i)%N] {
				b = true
			} else {
				b = false
			}
		}
		return b
	} else {
		for i, v := range rest {

			restx := make([]int, len(rest))
			copy(restx, rest)

			restx = append(restx[:i], restx[i+1:]...)
			headx := append(head, v)

			if b := perm(headx, restx); b {
				return b
			}
		}
		return false
	}
}