#include<iostream>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main(){
    ll n;
    cin >> n;
    ll a[n];
    ll ans = 0;
    for(int i = 0;i < n;i++) cin >> a[i];

    for(ll  i = 0;i <= 60;i++){
        ll t = 0;
        for(ll j = 0;j < n;j++){
            if(a[j]&(1LL<<i)) t++;
        }
        ans = (ans+(1LL<<i)%MOD*t%MOD*(n-t))%MOD;
    }
    cout << ans << endl;
}