#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	ll n;
	cin >> n;
	vector<ll> a(n);
	for(int i =0;i<n;i++)
	{
		cin >> a[i];
	}
	ll buff = 1;
	ll ans = 0;
	for(int i = 0;i<60;i++)
	{
		ll cnt0=0,cnt1 =0;
		for(int j=0;j<n;j++)
		{
			(a[j]&1?cnt1:cnt0)++;
			a[j]/=2;
		}
		ans = (ans + (cnt0*cnt1)%MOD*buff%MOD)%MOD;
		buff*=2;
		buff%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}