#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using ll = long long;
using namespace std;
constexpr ll MOD = 1e9 + 7;

ll n, a[300010];

int main()
{
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	
	ll ans = 0;
	for (int i = 0; i < 60; ++i) {
		ll cnt = 0;
		for (int j = 0; j < n; ++j) {
			if (a[j] >> i & 1) ++cnt;
		}
		ans = (ans + (1LL << i) % MOD * (n - cnt) % MOD * cnt % MOD) % MOD;
	}
	cout << ans;
	return 0;
}