package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	nums := ScanNums(n)
	nums = append(nums, nums[0])
	nums = append(nums, nums[1])
	ans := "No"
	for i := 1; i < n+1; i++ {
		if nums[i-1]^nums[i+1] != nums[i] {
			break
		}
		if i == n+1 {
			ans = "Yes"
		}
	}
	for i := n; i > 0; i-- {
		if nums[i-1]^nums[i+1] != nums[i] {
			break
		}
		if i == 1 {
			ans = "Yes"
		}
	}
	fmt.Println(ans)
}

func ScanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}
