#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b <= 0) return -1;
  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
ll mlpow(ll x, ll p) {
  ll tmp = 1;
  if (p == 0) return 1;
  while (p != 0) {
    if (p & 1) tmp = tmp * x % 1000000007;
    x = x * x % 1000000007;
    p = p >> 1;
  }
  return tmp;
}
int facnum = 200005;
vector<ll> fac(facnum);
vector<ll> facM2(facnum);
void faccal(ll up) {
  fac[0] = 1;
  facM2[0] = 1;
  for (ll i = 0; i < up + 1; i++) {
    fac[i + 1] = fac[i] * (i + 1) % 1000000007;
    facM2[i + 1] = facM2[i] * mlpow(i + 1, 1000000007 - 2) % 1000000007;
  }
}
ll comb(ll n, ll k) {
  if (n == 0 && k == 0) return 1;
  if (n < k || n < 0) return 0;
  ll tmp = facM2[n - k] * facM2[k] % 1000000007;
  return tmp * fac[n] % 1000000007;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) cin >> A[i];
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += (A[i] ^ A[j]) % 1000000007;
      ans %= 1000000007;
    }
  }
  cout << ans << "\n";
  return 0;
}
