#include <iostream>
#include <cstdio>
#define N 65
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll n, s, c[2][N];
int main()
{
	ll i, t;
	cin >> n;
	while (n--) {
		scanf("%lld", &t);
		for (i = 0; i < N; i++, t /= 2) {
			c[t % 2][i]++;
		}
	}
	for (i = 0; i < N; i++) {
		s = ((1LL << i) % M * c[0][i] % M * c[1][i] % M + s) % M;
	}
    cout << s << endl;
    return 0;
}