#include <bits/stdc++.h>

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    vector<ll>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    vector<ll>memo(60,0);
    for (int i = 0; i < 60; ++i) {
        for (int j = 0; j < n; ++j) {
            if(a[j]>>i&1))memo[i]++;
        }
    }
//    for (int i = 0; i < 5; ++i) {
//        cout <<i<<" "<<memo[i]<<" "<<(1LL<<i)<<endl;
//   }
    ll ans=0;
    for (int i = 0; i < 60; ++i) {
        ll x=memo[i]*(n-memo[i])%mod;
        for (int j = 0; j < i; ++j) {
            x*=2%mod;
        }
        ans+=x;
        ans%=mod;
//        cout <<i<<" "<<ans<<endl;
    }
    cout <<ans<<endl;
    return 0;
}