#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
constexpr int MOD = 1000000007;
int mod(const ll &x) { return x > 0 ? x % MOD : (x + MOD) % MOD; }
int modm(const ll &x, const ll &m) { return x * m % MOD; }
int modpow(ll x, ll p) {
  int ret = 1;
  while (p > 0) {
    if (p & 1) ret = modm(ret, x);
    x = modm(x, x);
    p >>= 1;
  }
  return ret;
}
int modd(ll x, ll d) { return modm(x, modpow(d, MOD - 2)); }
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<ll, int> m;
  for (int i = 0; i < (n); i++) {
    ll a;
    cin >> a;
    m[a]++;
  }
  vector<ll> v;
  for (auto p : m) v.push_back(p.first);
  int ans = 0;
  for (int i = 0; i < (v.size()); i++) {
    ll tmp = 0;
    for (int j = i + 1; j < (v.size()); j++)
      tmp = mod(tmp + modm(v[i] ^ v[j], m[v[j]]));
    ans = mod(ans + modm(tmp, m[v[i]]));
  }
  cout << ans << endl;
  return 0;
}
