#include <bits/stdc++.h>
long long int a[400000];
long long int n, m;
long long int s = 0, i, j, p;
int main() {
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    if (i >= 1) {
      s += a[0] ^ a[i];
      s = s % 1000000007;
    }
    if (i >= 2) {
      s += a[1] ^ a[i];
      s = s % 1000000007;
    }
    if (i >= 3) {
      s += a[2] ^ a[i];
      s = s % 1000000007;
    }
    if (i >= 4) {
      s += a[3] ^ a[i];
      s = s % 1000000007;
    }
    if (i >= 5) {
      s += a[4] ^ a[i];
      s = s % 1000000007;
    }
  }
  for (i = 5; i < n; i++)
    for (j = i + 1; j < n; j++) {
      p = (a[i] ^ a[j]);
      s += p;
      s = s % 1000000007;
    }
  printf("%lld\n", s);
}
