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