#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N;
	scanf("%d", &N);
	long long A[N], ans = 0;
	for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
	for (long long i = 1LL; i < (1LL << 60); i <<= 1) {
		long long cnt = 0;
		for (int j = 0; j < N; ++j) {
			if (A[j] & i) ++cnt;
		}
		cnt = cnt * (N - cnt) % 1000000007;
		ans += (i % 1000000007 * cnt % 1000000007);
		ans %= 1000000007;
	}
	printf("%lld", ans);
	return 0;
}
