#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5+10;
const ll M = 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(int i = 0;i < 60;++i){
		ll sum = 0;
		ll k = (1ll << i);
		for(int j = 1;j <= n;++j){
			if(k & a[j]) sum++;
		}
		ans += k%M*sum%M*(n-sum)%M;
		ans %= M;
	}
	
	printf("%lld\n",(ans+M)%M);
	return 0;
} 