#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
typedef long long ll;
typedef pair<int,int> P;

int main(){
	const int MOD = 1e9+7;
	int N;
	cin >> N;
	vector<ll> A;
	rep(i,N){ ll t; cin >> t; A.push_back(t); }

	ll ans = 0;
	for(int i=0; i<60; i++){
		ll o=0;
		rep(j,N){ if(A[j]>>i & 1)o++; }
		ll x = o*(N-o) % MOD;
		rep(j,i){ x = x*2 % MOD; }
		ans += x;
		ans %= MOD;
	}
	cout << ans << endl;
}

