#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

const MOD: usize = 1_000_000_007;

#[fastout]
fn main() {
    input! {
    n: usize,
    a: [usize; n]
    }
    let mut a_max = *(a.iter().max().unwrap());
    let mut k = 0;
    while a_max > 0 {
        a_max /= 2;
        k += 1;
    }
    let mut ans = 0;
    for i in 0..k {
        let (mut p, mut q) = (0, 0);
        for j in 0..n {
            if a[j] & 1 << i > 0 {
                p += 1;
            } else {
                q += 1;
            }
        }
        ans += p * q * (2usize.pow(i as u32) % MOD);
        ans %= MOD;
    }
    println!("{}", ans);
}
