#include <stdio.h>
#define N 60
#define M 1000000007
typedef long long LL;


int main() 
{
	LL m2, x, sum = 0, y;
	int i, j, c1[N] = {0}, n;
		
	scanf("%d", &n);
	for(i = 1; i <= n; i++){
		scanf("%lld", &x);
		j = 0;
		while(x){
			if(x & 1) c1[j]++;
			x >>= 1, j++;
		}
	}
	for(i = 0, m2 = 1, y = (LL)n; i < N; i++){
		x = (LL)c1[i];
		sum += x * (y - x) % M * m2 % M;
		m2 <<= 1;
		if(m2 >= M) m2 -= M;
	}
	printf("%lld\n", sum %= M);
	
	return 0;
}