#include <bits/stdc++.h>
#define mod 100011100011100000000111LL
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
void SieveOfEratosthenes(ll n);
ll fastpowMOD(ll a, ll p,ll MOD);
ll lcm(ll a, ll b);
const int LIM = 1e5+5, MOD =  1e9+7;
ll fastpowMOD(ll a, ll p,ll MOD){ if(p==0) return 1; a %= MOD; ll z = fastpowMOD(a,p/2,MOD); z = (z*z)%MOD; if(p%2) z = (z*a)%MOD; return z; }
bool seive[LIM];
 
void SieveOfEratosthenes(ll n)
{ memset(seive, true, sizeof(seive));
seive[0] = false;
seive[1] = false;
 for (ll p=2; p*p<=n; p++) if (seive[p] == true) for (ll i=p*p; i<=n; i += p) seive[i] = false; }
 
 
 ll combo(ll n, ll k){
 	if(k==0) return 1;
 	ll N=1,D=1;
 	for(ll i = 1;i<=k;i++){
 		N = (((n-i+1)%MOD)*N)%MOD;
 		D = (D*i)%MOD;
	 }
	 
	 return (N*fastpowMOD(D,MOD-2,MOD))%MOD;
 }
 
 
ll lcm(ll a, ll b)  
 {  
    return (a*b)/__gcd(a, b);  
 } 
/*********************************************/

int main(){
	fastio;
	int n;
	cin>>n;
	map<ll , pair<ll,ll> > mp;
	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		for(ll j=0;j<61;j++){
			if(a%2) mp[j].second++;
			else mp[j].first++;
			a = a/2;
		} 
		
	}

	ll ans = 0;
	for(ll j=0;j<61;j++){
		ans = (ans%MOD) + ((mp[j].first)*(mp[j].second)*fastpowMOD(2,j,MOD))%MOD;
	}
	cout<<ans<<"\n";
	
	
}
















