package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"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()

	if n%3 != 0 {
		var c int
		for i := 0; i < n; i++ {
			if a[i] == 0 {
				c++
			}
		}
		if c == n {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		var c int
		for i := 0; i < n; i++ {
			if a[i] == 0 {
				c++
			}
		}
		if c == n {
			fmt.Println("Yes")
			return
		}

		c = 0
		for i := 0; i < n; i++ {
			if a[i] == 0 {
				c++
			}
		}
		if c == n/3 {
			fmt.Println("Yes")
			return
		}

		sort.Ints(a)

		x := a[0]
		for i := 0; i < n/3; i++ {
			if x != a[i] {
				fmt.Println("No")
				return
			}
		}

		fmt.Println("Yes")
	}
}
