#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
  ll N;
  scanf("%lld", &N);
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  ll result = 0;
  for (ll i = (0); i <= (N - 1); i++) {
    for (ll j = (i + 1); j <= (N - 1); j++) {
      result += (A[i] ^ A[j]);
      result %= MOD;
    }
  }
  printf("%lld\n", result);
}
