#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  scanf("%d", &N);
  unsigned long A[N], l;
  int n = 0;
  while (n < N && cin >> l) {
    A[n] = l;
    n++;
  }
  unsigned long sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      unsigned long xor1;
      xor1 = (A[i] ^ A[j]);
      sum = sum + xor1;
    }
  }
  unsigned long answer = sum % (1000000000 + 7);
  printf("%ld\n", answer);
  return 0;
}
