const MOD: u64 = 1000000007;
fn main() {
    let n: usize = read();
    let a: Vec<u64> = read_vec();
    let mut sum: u64 = 0;
    let mut base;
    for d in 0..(60) {
        let mut onenum = 0;
        let mut zeronum = 0;
        for i in 0..n {
            if a[i] >> d & 1u64 == 0 {
                zeronum += 1;
            } else {
                onenum += 1;
            }
        }
        base = (1u64 << d) % MOD;
        sum += (base * onenum * zeronum) % MOD;
        sum %= MOD;
    }
    println!("{}", sum % MOD);
}

#[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> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
