#include <bits/stdc++.h>
int main(void) {
  int n;
  int a[300000];
  int i, j;
  int c;
  int x;
  int mod = 10000000007;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  x = 0;
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      c = a[i] ^ a[j];
      x = (x + c) % mod;
    }
  }
  printf("%d\n", x);
  return 0;
}
