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