#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int n,ans;
int cnt[70];
int main()
{
	scanf("%d",&n);
	long long x;
	for(int i=1;i<=n;++i)
	{
		scanf("%lld",&x);
		for(int j=0;j<60;++j)if(x>>j&1)++cnt[j];
	}
	for(int j=0;j<60;++j)ans=(ans+1ll*cnt[j]*(n-cnt[j])%mod*((1ll<<j)%mod))%mod;
	printf("%d",ans);
	return 0;
}
