#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<unsigned int> A(N, 0);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  unsigned int div = 1000000007;
  for (int i = 0; i < N; ++i) {
    A[i] = A[i] % div;
  }
  unsigned int sum = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      sum += A[i] ^ A[j];
    }
  }
  if (sum > div) {
    sum = sum % div;
  }
  printf("%i", sum);
  return 0;
}
