// D - Xor Sum 4
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define MOD 1000000007

int main(){
	int N; cin>>N;
	vector<ll> A(N); rp(i,0,N) cin>>A[i];
	ll ans = 0;
	rp(i, 0, 60){
		ll z=0,o=0; rp(j,0,N) if(A[j]>>i&1) o++; else z++;
		ans = (ans + (z*o % MOD) * ((1LL<<i) % MOD)) % MOD;
	}
	cout<< ans <<endl;
}