use std::io::Read;
const MOD: u64 = 1_000_000_007;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<u64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    let mut ans: u64 = 0;
    for bit in 0..60 {
        let mut cnt: u64 = 0;
        for i in 0..n {
            cnt += (a[i] >> bit) & 1;
        }
        ans = ans + ((1u64 << bit) % MOD) * (cnt * (n as u64 - cnt) % MOD) % MOD;
    }
    println!("{}", ans);
}