use proconio::{input, fastout};

const MOD: u64 = 1000000007;

fn modpow(a: u64, n: u64) -> u64 {
    let mut res: u64 = 1;
    let mut b: u64 = a;
    let mut m: u64 = n;
    loop{
        if m == 0 {
            break;
        }
        if m % 2 == 1 {
            res = (res * b) % MOD;
        }
        b = (b * b) % MOD;
        m = m >> 1;
    }
    res
}

#[fastout]
fn main() {
    input! {
        n: usize,
    }
    let mut v: Vec<usize> = vec![0; 64];
    for _ in 0..n {
        input! {
            mut a: u64,
        }
        for i in 0..64 {
            if a % 2 == 1 {
                v[i] += 1;
            }
            a = a >> 1;
        }
    }

    let mut ans: u64 = 0;

    for i in 0..64 {
        ans = (ans + (modpow(2,i) * (v[i as usize] as u64) * ((n - v[i as usize]) as u64) % MOD)) % MOD;
    }

    println!("{}",ans);

}
