#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=3e5+5,Mod=1e9+7;
ll a[N];
int main (){
	int n;scanf ("%d",&n);
	for (int i=1;i<=n;i++) scanf ("%lld",&a[i]);
	ll ans=0;
	for (ll i=60;i>=0;i--){
		int c1=0,c2=0;
		for (int j=1;j<=n;j++)
			if (a[j]&(1ll<<i)) c1++;else c2++;
		ans+=1ll*(1ll<<i)%Mod*c1%Mod*c2%Mod;
		ans%=Mod;
	}
	printf ("%lld",ans);
	return 0;
}