#include<bits/stdc++.h>
using namespace std;
const int N=300010,mod=1e9+7;
#define    ll  long long
ll ans=0;
ll a[N];
int main(){
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=0;i<60;i++)
    {
    	ll x=0;
    	for(int j=1;j<=n;j++)if(a[j]>>i &1)x++;
    	//cout<<x<<endl;
    	ll now=x*(n-x)%mod;
    	now= (1ll<<i)%mod*now%mod;
    	//cout<<now<<endl;
    	ans+=now;
    	ans%=mod;
    }
    printf("%lld",ans);
	return 0;
}
