#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

ll n,a,num[70][3],ans;
const ll mod=1e9+7;

signed main(){
    cin>>n;
    rep(i,n){
        cin>>a;
        rep(j,61){
            ll x=(1ll<<j)%mod;
            (ans+=num[j][!((a>>j)&1)]*x)%=mod;
            num[j][((a>>j)&1)]++;
        }

    }
    cout<<ans<<endl;
}
