#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll=long long;
constexpr ll MOD=1e9+7;

int main()
{
	int N;
	cin>>N;
	vector<ll> A(N);
	rep(i,N)cin>>A[i];
	ll res=0;
	rep(idx,60){
		ll cnt0=0,cnt1=0;
		for(auto a:A)((a>>idx)&1?cnt1:cnt0)++;
		ll tres = (1ll<<idx)%MOD;
		(tres*=cnt0)%=MOD;
		(tres*=cnt1)%=MOD;
		(res+=tres)%=MOD;
	}
	cout<<res<<endl;
	return 0;
}
