#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
bool pairCompare(const pair<ll, double>& firstElof,
                 const pair<ll, double>& secondElof) {
  return firstElof.second < secondElof.second;
}
signed main() {
  ll n;
  cin >> n;
  vector<ll> a(n + 1);
  ll ans = 0;
  for (ll i = 0; i < n; i++) cin >> a[i];
  for (ll i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += a[i] ^ a[j];
      ans %= 1000000007;
    }
  }
  cout << ans;
}
