#include <bits/stdc++.h>
int main(int argc, char** argv) {
  int N;
  std::cin >> N;
  std::vector<uint64_t> A(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
  }
  uint64_t ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      ans += A[i] ^ A[j];
      ans %= 1000000007ULL;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
