#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

const MOD: usize = 1000000007;
#[derive(Copy, Clone, Eq, PartialEq, std :: fmt :: Debug)]
struct ModInt(usize);
impl std::ops::Add for ModInt {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        ModInt((self.0 + rhs.0) % MOD)
    }
}
#[allow(clippy::suspicious_op_assign_impl)]
impl std::ops::AddAssign for ModInt {
    fn add_assign(&mut self, rhs: Self) {
        self.0 += rhs.0;
        self.0 %= MOD;
    }
}
impl std::ops::Sub for ModInt {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {
        ModInt((self.0 + MOD - rhs.0) % MOD)
    }
}
#[allow(clippy::suspicious_op_assign_impl)]
impl std::ops::SubAssign for ModInt {
    fn sub_assign(&mut self, rhs: Self) {
        self.0 += MOD - rhs.0;
        self.0 %= MOD;
    }
}
impl std::ops::Mul for ModInt {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self {
        ModInt((self.0 * rhs.0) % MOD)
    }
}
#[allow(clippy::suspicious_op_assign_impl)]
impl std::ops::MulAssign for ModInt {
    fn mul_assign(&mut self, rhs: Self) {
        self.0 *= rhs.0;
        self.0 %= MOD;
    }
}
impl std::ops::Div for ModInt {
    type Output = Self;
    fn div(self, rhs: Self) -> Self {
        ModInt((self.0 * rhs.pow(MOD - 2).0) % MOD)
    }
}
#[allow(clippy::suspicious_op_assign_impl)]
impl std::ops::DivAssign for ModInt {
    fn div_assign(&mut self, rhs: Self) {
        self.0 *= rhs.pow(MOD - 2).0;
        self.0 %= MOD;
    }
}
impl std::fmt::Display for ModInt {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0.to_string())
    }
}
impl ModInt {
    fn pow(&self, power: usize) -> ModInt {
        let mut acc_base = *self;
        let mut acc_pow = power;
        let mut res = ModInt(1);
        while acc_pow > 0 {
            if acc_pow & 1 == 1 {
                res *= acc_base;
            }
            acc_base *= acc_base;
            acc_pow >>= 1;
        }
        res
    }
}
struct ModIntFact {
    memo: Vec<ModInt>,
    memo_inv: Vec<ModInt>,
}
impl ModIntFact {
    fn new(size: usize) -> Self {
        let mut memo = vec![ModInt(0); size + 1];
        memo[0] = ModInt(1);
        for n in 1..=size {
            memo[n] = memo[n - 1] * ModInt(n);
        }
        let memo_inv = memo.iter().map(|x| x.pow(MOD - 2)).collect();
        Self { memo, memo_inv }
    }
    fn fact(&self, n: usize) -> ModInt {
        self.memo[n]
    }
    fn fact_inv(&self, n: usize) -> ModInt {
        self.memo_inv[n]
    }
    fn ncr(&self, n: usize, r: usize) -> ModInt {
        self.memo[n] * self.memo_inv[r] * self.memo_inv[n - r]
    }
}
impl std::iter::Sum for ModInt {
    fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
        iter.fold(ModInt(0), |x, y| x + y)
    }
}

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let ans: ModInt = (0usize..=59).map(|e| {
        let bit = 1 << e;
        let set = a.iter().filter(|x| **x & bit > 0).count();
        ModInt(set * (n - set)) * ModInt(bit % MOD)
    }).sum();
    println!("{}", ans);
}
