#include<iostream>
#include <vector>
using namespace std;

typedef ll long long;
const ll MOD = 1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<ll> b1(65, 0), b2(65, 0);

    long long ans = 0;

    for(int i = 0; i < n; i++) {
        long long x;
        cin >> x;
        for(int j = 0; j <= 60; j++){
            if((x & (1ll<<j))){
                b1[j]++;
            }
            else b2[j]++;
        }
    }

    for(int j = 0; j <= 60; j++){
        long long tmp = (b1[j] * b2[j])%MOD;
        tmp = (tmp * (1ll<<j)%MOD)%MOD;
        ans = (ans + tmp)%MOD;

    }
    cout << ans;

}
