#include <bits/stdc++.h>
long long in() {
  long long n = 0;
  int c;
  do c = getchar_unlocked();
  while (isspace(c));
  do n = 10 * n + (c & 0xf);
  while ((c = getchar_unlocked()) >= '0');
  return n;
}
int N;
long long A[100005];
int main() {
  int i, j, ans;
  N = (int)in();
  for (i = 0; i < N; ++i) {
    A[i] = in();
  }
  ans = 0;
  for (i = 0; i < N; ++i) {
    for (j = i + 1; j < N; ++j) {
      ans = ((long long)ans + (A[i] ^ A[j])) % 1000000007;
    }
  }
  printf("%d\n", ans);
  return 0;
}
