#include <bits/stdc++.h>
int main(void) {
  long long unsigned int N;
  long long unsigned int *A;
  long long unsigned int i, j, k, l;
  long long unsigned int mul = 0;
  long long unsigned int lim = 1e9 + 7;
  scanf("%lld", &N);
  A = (long long unsigned int *)malloc(N * sizeof(long long unsigned int));
  for (int s = 0; s < N; s++) {
    scanf("%lld", &k);
    A[s] = k;
  }
  for (i = 0; i < N - 1; i++) {
    for (j = i + 1; j < N; j++) {
      mul += A[i] ^ A[j];
      if (mul >= (1 << 30) - 1) mul = mul % lim;
    }
  }
  printf("%lld\n", mul % lim);
  return 0;
}
