#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ul = unsigned long long;

int main() {
	ul N; cin >> N;
	vector<ul> A(N + 1); rep(i, N) { cin >> A[i + 1]; }

	ul ans = 0;

	for (int i = 1; i <= N - 1; i++) {
		for (int j = i + 1; j <= N; j++) {
			ans += (A[i] ^ A[j]);
		}
	}

	cout << ans % 1'000'000'007 << endl;
}
