use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<u64> = (0..n).map(|_| read()).collect();

    let count_same_a1 = a.iter().filter(|&&x| x == a[0]).count();
    let count_same_a2 = a.iter().filter(|&&x| x == a[1]).count();
    let count_same_a1_xor_a2 = a.iter().filter(|&&x| x == a[0] ^ a[1]).count();
    let ans =
        if (n % 3 == 0 && count_same_a1 == count_same_a2 && count_same_a2 == count_same_a1_xor_a2)
            || a.iter().filter(|&&x| x == a[0]).count() == a.len()
        {
            "Yes"
        } else {
            "No"
        };

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
