#include <bits/stdc++.h>
using namespace std;
int Int() {
  int x;
  scanf("%d", &x);
  return x;
}
long long Long() {
  long long x;
  scanf("%lld", &x);
  return x;
}
float Float() {
  float x;
  scanf("%f", &x);
  return x;
}
double Double() {
  double x;
  scanf("%lf", &x);
  return x;
}
void err(istream_iterator<string> it) { cout << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ' ';
  err(++it, args...);
}
const int N = (int)2e5 + 5;
const int maxN = (int)1e6 + 6;
const long long Mod = (long long)1e9 + 7;
const int inf = (int)2e9;
const long long Inf = (long long)1e18;
int main() {
  int test = 1, tc = 0;
  long long n, i, j, ans = 0, x;
  while (test--) {
    n = Long();
    long long a[n + 1];
    a[0] = 0;
    for (i = 1; i <= n; i++) {
      a[i] = Long();
    }
    i = 1;
    for (i = 1; i < n; i++) {
      for (j = i + 1; j <= n; j++) {
        x = a[i] ^ a[j];
        ans += x;
        ans %= Mod;
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
