#include <bits/stdc++.h>
using namespace std;

#define For(i,a,b) for(long long (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9

typedef long long int ll;
const ll MOD = 1000000007ll;
const ll MOD_9 = 998244353;

ll N;
ll A[300000]
int main(){
    cin >> N;
    vector<ll> cnt(64,0ll);
    Rep(i,N){
        cin >> A[i];
        Rep(j,64){
            if(A[i] & (1ll << j)){
                cnt[j] += 1ll;
                //cout << i << sp << j;
            }
        }
    }
    ll ans = 0ll;
    ll pow_2 = 1ll;
    Rep(j,64){
        //cout << cnt[j] << endl;
        ll t = (N-cnt[j])*(cnt[j]);
        t %= MOD;
        ans += pow_2*t;
        ans %= MOD;
        pow_2 *= 2ll;
        pow_2 %= MOD;
    }
    cout << ans;
    //cin >> N;
}