#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e15;
const ll MOD=1000000007;

int main(){
    ll N;cin>>N;
    ll count[60];
    rep(i,60)count[i]=0;
    rep(i,N){
        ll A;cin>>A;
        rep(j,60)if(A&(1LL<<j))count[j]++;
    }
    ll ans=0;
    rep(i,60){
        ans+=(1LL<<i)%MOD*count[i]%MOD*(N-count[i])%MOD;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}