#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

int main(int argc, char **argv)
{
	int N;
	scanf("%d", &N);
	uint64_t *a = malloc(sizeof(uint64_t) * N);
	for (int i = 0; i < N; i++)
		scanf("%ld", &a[i]);
	uint64_t sum = 0;
	int sz[60] = {0};
	int so[60] = {0};
	for (int b = 0; b < 60; b++) {
		uint64_t c = (uint64_t)1 << b;
		for (int i = 0; i < N; i++) {
			if (a[i] & c)
				++so[b];
			else
				++sz[b];
		}
		fprintf(stderr, "%d: %d %d\n", b, sz[b], so[b]);
		if (sz[b] && so[b]) {
			sum += (c % 1000000007) * sz[b] * so[b];
			sum %= 1000000007;
		}
	}
	printf("%ld\n", sum % 1000000007);
	return 0;
}
