#[allow(unused_macros)] macro_rules! read { ([$t:ty] ; $n:expr) => ((0..$n).map(|_| read!([$t])).collect::>()); ($($t:ty),+ ; $n:expr) => ((0..$n).map(|_| read!($($t),+)).collect::>()); ([$t:ty]) => (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::>()); ($t:ty) => (rl().parse::<$t>().unwrap()); ($($t:ty),*) => {{ let buf = rl(); let mut w = buf.split_whitespace(); ($(w.next().unwrap().parse::<$t>().unwrap()),*) }}; } #[allow(dead_code)] fn rl() -> String { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); buf.trim_end().to_owned() } fn main() { let _n = read!(usize); let a_vec = read!([usize]); let mut now = vec![false; 1 << 15]; let mut next = vec![false; 1 << 15]; now[0] = true; for e in a_vec { // now[i]はeより前の要素のみでiが作れるか否か // next[i]がそこにeを加えて作れるものを指すように更新 for i in 0..now.len() { next[i ^ e] = now[i]; } for i in 0..now.len() { now[i] |= next[i] } } let ans = now .into_iter() .filter(|&e| e) .count(); println!("{}", ans); }