#include<bits/stdc++.h>
#define pb push_back
#define p2(x) (x)*(x)
#define len(x) (int)(x).size()
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = 1e9 + 7;
void md(int &a){
    while(a >= mod)a-=mod;
}

signed main(){
    ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    int n;
    cin >> n;
    vector < ll > a(n);
    for(auto &i : a)cin >> i;
    vector < LL > cnt(61);
    for(int j = 0  ; j < n; ++j){
        for(int bit = 0 ; bit <= 60; ++bit){
            if((1ll<<bit)&a[j])cnt[bit]++;
        }
    }
    int answer = 0 ;
    for(int j = 0 ; j  <= 60; ++j){
        answer += (1LL*(1ll*(1ll<<j)*(cnt[j]))%mod*(n-cnt[j]))%mod;
        md(answer);
    }
    cout << answer;
    return 0;
}
