#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define pb push_back

int32_t main(){
IOS;
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int ans = 0;
for(int i=60;i>=0;i--)
{
    int o=0,z=0;
    for(int j=0;j<n;j++)
    {
        if((a[j] >> i) & 1)
        o++;
        else
        {
            z++;
        }
    }
    ans += ((o*z)1000000007)*((pow(2 , i))%1000000007);
    ans %= (1000000007);
}
cout<<ans<<endl;
return 0;
}