#include <bits/stdc++.h>
int N;
long long int A[300000];
int main() {
  int ret, i, j;
  long long int total;
  ret = scanf("%d", &N);
  for (i = 0; i < N; i++) ret = scanf("%lld", &(A[i]));
  total = 0;
  for (i = 0; i < N - 1; i++) {
    for (j = i + 1; j < N; j++) {
      total = (total + (A[i] ^ A[j])) % 1000000007LL;
    }
  }
  printf("%lld\n", total);
}
