// amigos y no más
// dile a la jardinera que traigo flores
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MOD 998244353LL
#define MOD1 1000000007LL
#define LIM 262150
 
using namespace std;
 
typedef long long ll ;
 
int n;
int bits1[100] = {0};

int cont=0;
ll ans = 0LL;

int main() {
	fastio;
	cin>>n;
	for(int i=0; i<n;i++){
		ll x; cin>>x;
		cont=0;
		while(x){
			ll y = x&1LL;
			if(y == 1LL )(bits[cont])++;
			x = x>>1;
			cont++;
		}
	}
	
	for(int i=0; i<64;i++){
		int bits0 = n - bits[i] ; 
		ans = (ans + ( ( ((bits0 * bits[i])%MOD1)  * ( (1LL<<i) %MOD1)  ) % MOD1 ) )% MOD1;
	}
	
	cout<<ans<<"\n";
	return 0;
}