#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n){
        cin >> a[i];
    }
    int maxbit = log(*max_element(a.begin(), a.end())) / log(2) + 1; //sqrt(4) = 2 4 = 100 3bits
    maxbit = 60;
    ll ans = 0;
    rep(i, maxbit){
        ll bits[2] = {};
        rep(j, n){
            if(a[j] & (1LL << i)){ //i番目のbitが1
                bits[1]++;
            }else{
                bits[0]++;
            }
        }
        //ans = (ans % MOD + (1LL * (bits[1] * bits[0]) % MOD * ((1LL << i) % MOD)) % MOD) % MOD;
        //ans +=((1LL*bits[0]*bits[1])%MOD*(1LL << i)%MOD) % MOD;
        ans = (ans%MOD+(1LL*bits[0]*bits[1])%MOD*(1LL<<i)%MOD)%MOD
        //ans %= MOD;
        //cout << i+1 << ":" << bits[0] << " " << bits[1] <<  endl;
    }
    cout << ans%MOD << endl;
}

