#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

typedef long long int LL;

int main()
{
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);
	cin.tie(NULL);


	int N;
	LL answer = 0;
	LL div = pow(10,9) + 7;
	cin >> N;

	vector<LL> arr(N + 1);

	for (int i = 1; i <= N; i++)
		cin >> arr[i];


	for (int i = 1; i <= N - 1; i++)
	{
		for (int j = i + 1; j <= N; j++)
		{
			answer += (arr[i] ^ arr[j]);
		}
		answer %= div;
	}
	

	cout << answer<< endl;
	return 0;
}
