#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int64_t a[n];
	for (auto &i : a) std::cin >> i;
	int64_t res = 0;
	for (int i = 0; i < 60; i++) {
		int cnt = 0;
		for (auto j : a) if (j >> i & 1) cnt++;
		res += (1LL << i) % 1000000007 * cnt % 1000000007 * (n - cnt) % 1000000007;
	}
	std::cout << res % 1000000007 << std::endl;
	return 0;
}
