#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  std::vector<unsigned long long> A(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
  }
  unsigned 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];
    }
  }
  unsigned long long result = sum % (1000000000 + 7);
  std::cout << result;
  return 0;
}
