#![allow(unused_imports, unused_variables, dead_code, non_snake_case, unused_macros)] use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; use std::fmt::*; use std::str::*; use std::cmp::*; use std::collections::*; fn getline() -> String { let mut res = String::new(); std::io::stdin().read_line(&mut res).ok(); res } macro_rules ! readl { ( $ t : ty ) => { { let s = getline ( ) ; s . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,+ ) => { { let s = getline ( ) ; let mut iter = s . trim ( ) . split ( ' ' ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; } macro_rules ! readlvec { ( $ t : ty ) => { { let s = getline ( ) ; let iter = s . trim ( ) . split ( ' ' ) ; iter . map ( | x | x . parse ( ) . unwrap ( ) ) . collect ::< Vec <$ t >> ( ) } } } macro_rules ! mvec { ( $ v : expr , $ s : expr ) => { vec ! [ $ v ; $ s ] } ; ( $ v : expr , $ s : expr , $ ( $ t : expr ) ,* ) => { vec ! [ mvec ! ( $ v , $ ( $ t ) ,* ) ; $ s ] } ; } macro_rules ! debug { ( $ x : expr ) => { println ! ( "{}: {:?}" , stringify ! ( $ x ) , $ x ) } } fn printiter<'a, T>(v: &'a T) where &'a T: std::iter::IntoIterator, <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display, { for (i, e) in v.into_iter().enumerate() { if i != 0 { print!(" "); } print!("{}", e); } println!(""); } struct ContestPrinter { s: String, } impl ContestPrinter { fn new() -> ContestPrinter { ContestPrinter { s: String::new() } } fn print(&mut self, x: T) where T: std::fmt::Display, { self.s.push_str(format!("{}", x).as_str()); } fn println(&mut self, x: T) where T: std::fmt::Display, { self.s.push_str(format!("{}\n", x).as_str()); } } impl std::ops::Drop for ContestPrinter { fn drop(&mut self) { print!("{}", self.s); } } fn is_max_i64(num: i64) -> bool { if num == i64::max_value() { true } else { false } } macro_rules! get { ($t:ty) => { { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim().parse::<$t>().unwrap() } }; ($($t:ty),*) => { { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( $(iter.next().unwrap().parse::<$t>().unwrap(),)* ) } }; ($t:ty; $n:expr) => { (0..$n).map(|_| get!($t) ).collect::>() }; ($($t:ty),*; $n:expr) => { (0..$n).map(|_| get!($($t),*) ).collect::>() }; ($t:ty ;;) => { { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|t| t.parse::<$t>().unwrap()) .collect::>() } }; ($t:ty ;; $n:expr) => { (0..$n).map(|_| get!($t ;;)).collect::>() }; } pub trait InputValue { fn parse(s: &str) -> Self; } pub fn read() -> T { let mut buf = String::new(); let _ = stdin().read_line(&mut buf); T::parse(&buf.trim()) } pub fn readnc() -> Vec { let mut vec = vec![]; let line: String = read(); for token in line.split_whitespace() { vec.push(T::parse(token)); } vec } pub fn readn(n: usize) -> Vec { let mut vec = vec![]; for _ in 0..n { vec.push(read()); } vec } macro_rules! parse_single_value { ($($t:ty),*) => { $( impl InputValue for $t { fn parse(s: &str) -> $t { s.parse().unwrap() } } )* } } parse_single_value!(i32, i64, f32, f64, usize, String); macro_rules! parse_tuple { ($($t:ident),*) => { impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* { fn parse(s: &str) -> ($($t),*) { let mut tokens = s.split_whitespace(); let t = ($($t::parse(tokens.next().unwrap())),*); t } } } } parse_tuple!(A, B); parse_tuple!(A, B, C); fn main() { let mut pr = ContestPrinter::new(); let N: usize = read(); let v: Vec = readnc(); let mut dp = vec![false; 32770]; dp[0] = true; let mut ans = 0; for k in 1..N+1 { let a = v[k-1]; for i in 0..32770 { if dp[i] { let idx = i ^ a; if idx >= 32770 { continue; } dp[idx] = true; } } } for i in 0..32770 { if dp[i] { ans += 1; } } pr.println(ans); }