fn main() {
    let _ = read::<usize>();
    let v = read_vec::<u64>();
    const MOD: u64 = 1000000007;
    let d = 64;

    let mut cnt = vec![vec![0, 0]; d];
    for a in v.iter() {
        for j in 0..d {
            if (1 << j) & a != 0 {
                cnt[j][1] += 1;
            } else {
                cnt[j][0] += 1;
            }
        }
    }

    let mut ret = 0;
    for i in 0..d {
        ret += cnt[i][0] * cnt[i][1] * exp2(i);
        ret %= MOD;
    }
    println!("{}", ret)
}

fn exp2(n: usize) -> u64 {
    const MOD: u64 = 1000000007;
    if n == 0 {
        1
    } else {
        let tmp = 2 * exp2(n - 1);
        tmp % MOD
    }
}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}
