#include <bits/stdc++.h>
int main(void) {
  unsigned long long int N, B, i, j;
  unsigned long long sum = 0;
  unsigned long long int A[30001];
  scanf("%llu", &N);
  for (i = 1; i <= N; i++) scanf("%llu", &A[i]);
  for (i = 1; i <= N - 1; i++)
    for (j = i + 1; j <= N; j++) {
      B = A[i] ^ A[j];
      sum += B % 1000000007;
    }
  sum %= 1000000007;
  printf("%llu", sum);
  return 0;
}
