const MOD: u64 = 1000000007;

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn main() {
    let n: u32 = read();
    let a: Vec<u64> = read_vec();
    let mut sum: u64 = 0;
    for d in 0..(60) {
        let mut onenum = 0;
        let mut zeronum = 0;
        for i in 0..n as usize {
            if (a[i] >> d) & 1 == 1 {
                onenum += 1;
            } else {
                zeronum += 1;
            }
        }
        let base = (1u64 << d) % MOD;
        sum += onenum * zeronum * base % MOD;
        sum %= MOD;
    }
    println!("{}", sum);
}
