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