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()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}
const MODULO: usize = 1_000_000_000 + 7;
fn main() {
    let n = read::<usize>();
    let a = read_vec::<usize>();

    let mut ans = 0;

    for i in 0..60 {
        let mut count = 0;
        for j in 0..n {
            if a[j]>>i & 1 == 1 {
                count += 1;
            }
        }
        let mut a = count * (n - count) % MODULO;
        a = (a * ((2 as f64).powf(i as f64) as usize)) % MODULO;
        ans += a;
    }
    
    println!("{}", ans % MODULO);
}