#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define print(x) cout << x << endl;
typedef long long ll;

int main() {
	int n; cin >> n;
	const int INF = pow(10, 9) + 7;
	vector<ll> x(n);
	rep(i, n) cin >> x[i];
	ll ans = 0;
	rep(i, n-1) {
		rep(j, n) {
			if (j > i) {
				ans += (x[i] ^ x[j]);
				ans %= INF;
			}
		}
	}
	cout << ans << endl;
	return 0;
}
