#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	ll n; cin >> n;
	vector<ll> a(n);
	for( auto &k : a ) cin >> k;
	ll ans = 0;
	for( int i = 0; i < 60; ++i ){
		ll nll = 0, eins = 0;
		for( int k = 0; k < n; ++k ){
			if( a[k] & (1ll<<i) ) ++eins;
			else ++nll;
		}
		ans += (1ll<<i)%mod * ((nll*eins)%mod) ;
		ans %= mod;
	}
	cout << ans << endl;
}