#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;
	for (int i = 0; i < (N - 1); i++) {
		for (int j = i + 1; j < N; j++) {
			sum += a[i] ^ a[j];
			if (sum & 0x2000000000000000UL)
				sum %= 1000000007;
		}
	}
	printf("%ld\n", sum % 1000000007);
	return 0;
}
