//HovalHaq!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000 * 1000 * 1000 + 7;
ll A[64];

int main() {
	int n; cin >> n;
	for(int i = 0; i < n; i++) {
		ll x; cin >> x;
		for(int bit = 0; bit < 60; bit++)
			if(x & (1ll << bit))
				A[bit] ++;
	}
	int r = 0;
	for(int i = 0; i < 60; i++)
		r = (r + ((A[i] * (n - A[i])) % INF) * ((1ll << i) % INF)) % INF;
	cout << r;
}
