#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;

unsigned uint64_t A[100001];

ll modexp(int i, ll p){
	if(p == 0) return 1;
	ll ans = modexp(i,p/2);
	ans = (ans*ans)%MOD;
	if(p%2) ans =  (i*ans)%MOD;
	return ans;
}

void solve(){
	int n; cin>>n;
	for(int i=0; i<n; i++){
		cin>>A[i];
	}
	ll ans=0;
	for(int bit=0; bit<60; bit++){
		ll x=0;
		for(int i=0; i<n; i++){
			if((A[i] & (1ULL<<bit))){
				x++;
			}
		}
		//cout<<bit<<" : "<<x<<" sex\n";
		x = (x*(n-x))%MOD;
		ans += (modexp(2,bit)*x)%MOD;
		ans = ans%MOD;
	}
	cout<<ans;

}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout<<fixed<<setprecision(12);
	int t =1; //cin>>t;
	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}