#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
const ll MOD=1e9+7;
ll a[300005];
int main()
{
    int n;
    cin>>n;
    ll ans=0;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<60;i++)
    {
        ll t=0;
        for(int j=0;j<n;j++)
        {
            if(a[j]&(1LL<<i)) t++;
        }
        ans=(ans+(((t*(n-t))%MOD)*((1LL<<i)%MOD)))%MOD;
    }
    cout<<ans<<'\n';
}
