#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
typedef long long ll;
const ll mod = 1000000007;
int main(){
    ll n,i,j,x,ans=0LL,divider=1;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a.at(i);
    rep(i,60){
        x=0LL;
        rep(j,n){
            if(((a.at(j)%(2*divider)/divider)==1)x++;
        }
        divider*=2LL;
        x*=(n-x);
        rep(j,i)x=(x*2)%mod;
        ans+=x;
        ans%=mod;
    }
    cout << (ans%mod) << endl;
}