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)
		if i > 2 {
			if hats[(N+i-2)%N]^hats[(N+i)%N] != hats[(N+i-1)%N] {
				fmt.Println("No")
				return
			}
		}
	}
	if hats[N-1]^hats[1] != hats[0] && hats[0]^hats[N-2] != hats[N-1] {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
}