#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
ll n,ans,mod=1e9+7,a[105];
int main(){
	n=read();
	for(int i=0;i<n;i++){
		ll x=read();
		for(int j=0;j<60;j++)
			a[j]+=x>>j&1;
	}
	for(int i=0;i<60;i++)
		(ans+=(a[i]*(n-a[i]))%mod*((1ll<<i)%mod))%=mod;
	printf("%lld",ans);
	return 0;
}