#include <iostream>
#include <cstdio>
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll n, ans, s[100][2], w[100];
int main()
{
	ll i, j, t, x, z;
	cin >> n;
	w[0] = 1;
	for (i = 1; i <= 61; i++) w[i] = (w[i - 1] * 2) % M;
	for (i =0; i < n; i++) {
		scanf ("%lld", &t);
		x = t;
		for (j = 0; j <= 61; j++) {
			z= x % 2;
			ans = (ans + s[j][1 - z] * w[j]) % M;
			s[j][z]++;
			x /= 2;
		}
	}
	cout << ans << endl;
    return 0;
}
