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