#include <bits/stdc++.h>
#define int long long
#define MOD 1000000007
using namespace std;

int n,a[300010];

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	int ans=0ll;
	for(int i=1;i<=60;i++){
		int cnt=0;
		for(int j=1;j<=n;j++) if(a[j]&(1ll<<(i-1))) cnt++;
		ans=ans+(((1ll<<(i-1))%MOD)*((cnt*(n-cnt))%MOD))%MOD;
		if(ans>=MOD) ans-=MOD;
	}
	cout<<ans<<endl;
	return 0;
}
