use std::collections::HashMap; //TODO fn main() { let mut nx = String::new(); std::io::stdin().read_line(&mut nx).ok(); let nx: Vec = nx.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nx[0]; let x = nx[1]; let mut mapping: HashMap = HashMap::new(); for _ in 0..n { let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: usize = a.trim().parse().unwrap(); if let Some(b) = mapping.get_mut(&a) { *b += 1; } else { mapping.insert(a, 1); } } let mut result: usize = 0; mapping.iter().for_each(|pair| { let b = pair.0 ^ x; if x != 2 { result += pair.1 * mapping.get(&b).unwrap_or(&0usize); } else { result += pair.1 * (pair.1 - 1) / 2; } }); if x != 0 { result /= 2; } println!("{}", result); }