#include<iostream>
#include<algorithm>
#include<cmath>
typedef long long ll;
using namespace std;

ll power(ll num){
    power2 = 1;
    for(int i=0; i<num; i++) power2 *= 2;
    return power2;
}

int main(){
    int N; cin >> N;
    ll A[N], ans = 0;
    int one[60] = {}, count = 0, amari;
    for(int i=0; i<N; i++) cin >> A[i];

    // A[i] = 2進数で2^i桁目が1になる数字の数
    for(int i=0; i<60; i++){
        for(int j=0; j<N; j++){
            one[i] += A[j]%2;
            A[j] = A[j]/2;
        }
    }
    for(int i=0; i<60; i++){
        if(one[i] == 0) continue;
        ans += one[i]*(N-one[i])*power(2, i);
        ans = ans%1000000007;
    }
    cout << ans << endl;
}
