use proconio::input;

const MOD: usize = 1_000_000_007;

fn main() {
  input! {
    n: usize,
    ai: [usize;n]
  }
  
  let mut sum = 0;
  for i in 0..=60 {
    let mut count = 0;
    for v in ai.iter() {
      if *v >> i & 1 == 1 {
        count += 1;
      }
    }
    let s_sum = count * (n - count) % MOD;
    let s_sum = s_sum * 2usize.pow(i as u32) % MOD;
    sum = s_sum + sum % MOD;
  }
  println!("{}", sum);
}