let a=Int(readLine()!)!
var arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

arr.append(arr[0])
arr.append(arr[1])

var no = 0

for i in 1...a  {
  if( ( arr[i-1] ^ arr[i+1] ) != arr[i] ) {
    no = 1
    break
  }
}

if( no != 1 ) {
	print("Yes")
} else {
	print("No")
}