#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn shift(x: i64) -> i64 { x / 2 + (x % 2) * (1 << 15) } fn main() { let n = read::(); let a = read_vec::() .iter() .map(|&x| x.count_ones() as i64) .sum::(); debug!(a); let ans = (0..min(a, 16)).map(|x| 1 << (15 - x)).sum::(); println!("{}", ans); } 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() }