#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
int main(){
    int N;
    cin >> N;
    long long cnt = 0, cntb = 0;
    vector<long long> A(N,0);
    rep(i,N){
        cin >> A[i];
    }
    long long sum = 0;
    rep(i,61){
        cnt = 0;
        cntb = 0;
        rep(j,N){
            ((A[j] >> i) & (long long)(1) == (long long)(1))? (cnt++):(cntb++);
        }
        sum += (cnt*(cntb*(long long((long long)(1) << i))%mo)%mo) % mo;
        sum = sum % mo;
    }
    //cout << mo << endl;
    cout << sum << endl;
}
