#include <iostream>
using namespace std;
#define NMAX 300000

int n;
long long a[NMAX];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf_s("%lld", &a[i]);
	}
	
	long long sum = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			sum += a[i] ^ a[j];
			sum %= 1000000007;
		}
	}
	cout << sum << endl;

	return 0;
}