fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn main() { let _: usize = read(); let bs: Vec = read_vec(); /* let mut dp = std::collections::HashSet::new(); dp.insert(0); for b in bs { let mut results = std::collections::HashSet::new(); for num in &dp { let result = num ^ b; results.insert(result); } for result in results { dp.insert(result); } } println!("{:?}", dp.len()); */ let mut dp = [false; 32768]; dp[0] = true; for b in bs { for i in 0..32768 { if dp[i] { dp[i ^ b] = true; } } } let mut ans = 0; for i in 0..32768 { if dp[i] { ans += 1; } } println!("{:?}", ans); }