#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, A, COUNT[60] = {};
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A;
		for (int j = 0; j < 60; j++) {
			COUNT[j] += A % 2;
			A /= 2;
		}
	}
	long long ANS = 0;
	for (long long i = 0; i < 60; i++) {
		ANS += (((COUNT[i] * (N - COUNT[i])) % 1000000007) * ((1LL << i) % 1000000007)) % 1000000007;
		ANS %= 1000000007;
	}
	cout << ANS << endl;
}