// D - Xor Sum 4
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,e) for(ll i=0;i<(e);++i)
#define MOD 1000000007
ll in(){ll x;scanf("%lld",&x);return x;}

ll O[60];

int main(){
	ll j, a, ans=0, N; cin>>N;
	rp(i,N){ for(j=0,a=in(); a; a>>=1) O[j++]+=a&1; }
	rp(i,60) ans = (ans + (O[i]*(N-O[i]) % MOD) * ((1LL<<i) % MOD)) % MOD;
	cout<<ans<<endl;
}