#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll cnt[110];

int main(){
	ll n;
	cin>>n;

	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		ll now=0,num=1;
		while (1) {
			if(num>a)break;
			if(num&a)cnt[now]++;
			now++;
			num*=2;
		}
	}
	ll mod=1e9+7;
	ll ans=0;
	for(int i=0;i<61;i++){
		ll x=(1ll)<<i;
		x%=mod;
		x*=cnt[i];
		x%=mod;
		x*=n-cnt[i];
		x%=mod;
		ans+=x;
		ans%=mod;
	}
	cout<<ans;
	return 0;
}
