#include <bits/stdc++.h>
template <class _T>
static _T tp_abs(const _T& a) {
  return ((a < 0) ? (a * -1) : a);
}
template <class _T>
static _T tp_min(_T a, _T b) {
  return a < b ? a : b;
}
template <class _T>
static _T tp_max(_T a, _T b) {
  return a > b ? a : b;
}
template <class _T>
static void get1int(_T& a) {
  const char* fmt = " %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld";
  }
  if (scanf(fmt, &a) < 0) {
    printf("g1int Error\n");
  }
}
template <class _T>
static void get2int(_T& a, _T& b) {
  const char* fmt = " %d %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld %lld";
  }
  if (scanf(fmt, &a, &b) < 0) {
    printf("g2int Error\n");
  }
}
template <class _T>
static void get3int(_T& a, _T& b, _T& c) {
  const char* fmt = " %d %d %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld %lld %lld";
  }
  if (scanf(fmt, &a, &b, &c) < 0) {
    printf("g3int Error\n");
  }
}
static void getstring(char* buff) {
  if (scanf(" %s", buff) < 0) {
    printf("getstr error!\n");
  }
}
static const long long MOD_NUM = 1000000007LL;
static void D_task();
int main() {
  D_task();
  fflush(stdout);
  return 0;
}
static void D_task() {
  int N;
  get1int(N);
  std::vector<long long> seq(N, 0);
  for (int i = 0; i < N; i++) {
    long long tmp;
    get1int<long long>(tmp);
    seq[i] = tmp;
  }
  long long ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      long long tmp = seq[i] ^ seq[j];
      ans += tmp;
      ans %= MOD_NUM;
    }
  }
  printf("%lld\n", ans);
}
