#include<bits/stdc++.h>
using namespace std;
const int MN = 3e5+5, LOG = 60, MOD = 1e9+7;
using pii = pair<int,int>;
using ll = long long;
int cnt1[LOG];
int main () {
	int n;
	scanf ("%d",&n);
	ll a;
	for (int j = 0; j < n; j++) {
		scanf ("%lld",&a);
		for (int i = 0; i < LOG; i++) cnt1[i] += a>>i&1;
	}
	ll ans = 0;
	for (int i = 0; i < LOG; i++) ans = (ans+(1LL<<i)%MOD*(cnt1[i])%MOD*(n-cnt1[i])%MOD)%MOD;
	printf ("%lld\n",ans);
	return 0;
}