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