#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<ll> A(N+1);
    rep(i,N){
        cin >> A[i];
    }
    ll ans=0;
    for(int i=0;i<60;i++){
        ll count=0;
        for(int j=0;j<N;j++){
            ll asd = A[j]>>i;
            if((asd&1) != 0){
                count++;
            }
        }
        ll tmp = count*(N-count);
        tmp %= MOD;
        //ans+=pow(2,i)*tmp;
        ll p = (pow(2,i) % MOD);
        ans += (p * tmp);
        ans %= MOD;
    }    
    cout << ans << endl;
    return 0;
}