// 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;
	ll Z[60], O[60]; rp(i,0,60) Z[i] = O[i] = 0;
	rp(i, 0, N){
		ll a; scanf("%lld",&a);
		rp(j, 0, 60) if((a>>j)&1) O[j]++; else Z[j]++;
	}
	ll ans = 0;
	rp(i, 0, 60) ans = (ans + (Z[i]*O[i] % MOD) * ((1LL<<i) % MOD)) % MOD;
	cout<< ans <<endl;
}