#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9 + 7;

int main(){
	int N; cin >> N;
	ll A[N];
	for(int i=0; i<N; i++) cin >> A[i];
	ll ans = 0;
	for(int i=0; i<62; i++){
		ll p = 0, q = 0;
		for(int j=0; j<N; j++){
			if(A[j]>>i & 1) p++;
			else q++;
		}
		ll now = p*q%mod;
		for(int j=0; j<i; j++){
			now = now * 2 % mod;
		}
		ans += now;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}
