#include <bits/stdc++.h>
#define ll long long

const int MOD = 1e9 + 7;
const int N = 3e5 + 7;
int cnt[70][2];
ll A[N];

int main() {
	int n;
	scanf("%d", &n);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", A + i);
		for (int j = 0; j <= 60; j++) {
			int id = A[i] >> j & 1;
			id ^= 1;
			(ans += (1LL << j) % MOD * cnt[j][id] % MOD) %= MOD;
			cnt[j][A[i] >> j & 1]++;
		}
	}
	printf("%d\n", ans);
	return 0;
}