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

int main() {
	int n;
	cin >> n;
	vector<ll> v(n);
	rep(i, n) {
		cin >> v.at(i);
	}
	ll ans = 0;
	for (int j = 0; j < 60; j++) {
		ll n0 = 0;
		ll n1 = 0;
		rep(i, n) {
			if (v.at(i) & (1LL << j)) n1++;
			else n0++;
		}
		ans += ((n1 * n0)%mod) *((1LL << j)%mod);
	}
	ans %= mod;
	cout << ans << endl;
	return 0;
}