use std::io;
use std::str::FromStr;

const MOD: u64 = 1000000007;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}


fn main() {
    let n: usize = input();
    let a_vec = input_vec();
    let mut a_bit_vec: Vec<Vec<char>> = Vec::new();
    for a in a_vec {
        let bit: String = format!("{:b}", a);
        let mut bit: Vec<char> = bit.chars().collect();
        bit.reverse();
        a_bit_vec.push(bit);
    }

    let mut sum = 0;
    for i in 0..60 {
        let mut zero = 0;
        let mut one = 0;
        for a_bit in &a_bit_vec {
            if a_bit.len() > i {
                if a_bit[i] == '0' {
                    zero += 1;
                } else {
                    one += 1;
                }
            } else {
                zero += 1;
            }
        }    
        // println!("{}, {}", zero, one);
        sum += 2u64.pow(i as u32) % MOD * zero * one % MOD;
        sum %= MOD;
    }
    println!("{}", sum);
}
