fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn rep<T, F: FnMut() -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|_| f()).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let a: Vec<usize> = rep(n, || scan(tokens));
    let mut ans = 0;
    for i in 0..60 {
        let bit = 1 << i;
        let count = a.iter().filter(|&&ai| ai & bit == 0).count();
        ans += bit * count * (n - count);
        ans %= MODULO;
    }
    println!("{}", ans);
}

const MODULO: usize = 1_000_000_007;
