#include <bits/stdc++.h>
int main() {
  int N;
  unsigned long long *A;
  unsigned long long sum = 0;
  scanf("%d", &N);
  A = (unsigned long long *)malloc(N * sizeof(unsigned long long));
  for (int i = 0; i < N; i++) scanf("%llu", &A[i]);
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if (i != j) {
        sum += A[i] ^ A[j];
      }
    }
  }
  long long pow10 = pow(10, 9) + 7;
  long long result = sum % (pow10);
  printf("%lld\n", result);
}
