#include<bits/stdc++.h>
using namespace std;
#define int long long 
int MOD  = 1e9 + 7;
int N;

int mazak(){
	int ans = 0;
	int mul = 1;
	int arr[N];
	for(int i=0;i<N;++i)
		cin>>arr[i];

	for(int k=0;k<60;++k){
		int ones = 0;
		for(int i=0;i<N;++i){
			if((arr[i])&(1ll << k))
				++ones;
		}
		ans += ((ones*(N-ones))%MOD)*mul;
		ans %= MOD;
		mul *= 2;
		mul %=MOD;
	}
	return ans;
}

signed main(){

	cin>>N;
	cout<<mazak();

}