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

const int mod = 1000000007;

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	rep(i, N) cin >> A[i];

	ll ans = 0;
	rep(i, 60) {
		ll x = 0;
		rep(j, N) {
			if((A[j] >> i) & 1) ++x;
		}
		ll now = x * (N - x) % mod;
		rep(j, i) now = (now * 2) % mod;
		ans += now;
		ans %= mod;
	}

	cout << ans << endl;

	return 0;
}