package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func atoi(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}

func readInt() int {
	return atoi(readLine())
}

func readInts() []int {
	in := readLine()
	ins := strings.Split(in, " ")
	out := make([]int, len(ins))
	for i, v := range ins {
		out[i] = atoi(v)
	}
	return out
}

func judge(a []int) bool {
	for i := 0; i < len(a); i++ {
		if i == 0 {
			if a[0] != a[len(a)-1]^a[1] {
				return false
			}
		} else if i == len(a)-1 {
			if a[len(a)-1] != a[i-1]^a[0] {
				return false
			}
		} else {
			if a[i] != a[i-1]^a[i+1] {
				return false
			}
		}
	}
	return true
}

func main() {
	n := readInt()
	a := readInts()

	b := make([]int, n)
	// c := make([]int, n)
	copy(b, a)
	// copy(c, a)
	if judge(b) {
		fmt.Println("Yes")
		return
	}
	for i := 0; i < n-1; i++ {
		b[i], b[i+1] = b[i+1], b[i]
		if judge(b) {
			fmt.Println("Yes")
			return
		}
		// fmt.Println("b:", b)
		b[n-1-i], b[n-1-(i+1)] = b[n-1-(i+1)], b[n-1-i]
		if judge(b) {
			fmt.Println("Yes")
			return
		}
		// fmt.Println("b:", b)
		// fmt.Println("c:", c)
	}

	fmt.Println("No")
}
