use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n).map(|_| iterator.next().unwrap().parse().unwrap()).collect();

    let k: usize = keta(*a.iter().max().unwrap());
    let mut v: Vec<Vec<usize>> = vec![vec![0, 0]; k];
    for i in 0..n {
        let mut ai = a[i];
        for j in (0..k).rev() {
            v[j][ai % 2] += 1;
            ai /= 2;
        }
    }

    const MOD: usize = 1_000_000_007;
    let mut ans: usize = 0;
    let mut x = 1;
    for i in (0..k).rev() {
        ans += (((v[i][0] * v[i][1]) % MOD) * x) % MOD;
        ans %= MOD;
        x *= 2;
    }
    ans.to_string()
}

fn keta(mut x: usize) -> usize {
    if x == 0 {
        return 0;
    }
    let mut result = 0;
    while x > 0 {
        x /= 2;
        result += 1;
    }
    result
}
