#include<bits/stdc++.h>

using namespace std;

using ll  = long long;

ll d = 1e9+7;

int main() {

	ll N;
	cin>>N;
	vector<ll> A(N);
	for (auto &x : A) {
		cin>>x;
	}
	
	ll ans = 0;
	ll y = 0;
	for (ll c = 0;c < 60;++c) {
		y = 1LL<<c;
		ll a = 0, b = 0;
		for (auto &x : A) {
			if (x&y) a += 1;
			else b += 1;
		}
		
		ans += ((y%d)*((a*b)%d))%d;
	}
	
	cout<<ans%d<<endl;
	return 0;
}
