#[macro_export] macro_rules! setup { { mut $input:ident: SplitWhitespace $(,)? } => { use std::io::Read; let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).ok(); let mut $input = buf.split_whitespace(); }; } #[macro_export] macro_rules! parse_next { ($str_iter:expr) => { $str_iter.next().unwrap().parse().ok().unwrap() }; } fn main() { setup! { mut input: SplitWhitespace }; let n: usize = parse_next!(input); let x: usize = parse_next!(input); let a: Vec = (0..n).map(|_| parse_next!(input)).collect(); let mut c = std::collections::HashMap::new(); for i in 0..n { let key = x ^ a[i]; if let Some(value) = c.get_mut(&key) { *value += 1; } else { c.insert(key, 1); } } let ans = (|| { let mut count = 0; for i in 0..n { if let Some(value) = c.get(&a[i]) { count += *value; } } if x == 0 { count -= n; } count / 2 })(); println!("{}", ans); }