#include <bits/stdc++.h>
constexpr unsigned long mod_p{1000000007};
int main(int argc, char** argv) {
  int N;
  std::cin >> N;
  std::vector<unsigned long> vec(N);
  for (auto i = 0; i < N; ++i) {
    std::cin >> vec[i];
  }
  unsigned long sum{};
  for (auto i = 0; i < N; ++i) {
    for (auto j = i + 1; j < N; ++j) {
      sum += (vec[i] ^ vec[j]) % mod_p;
      sum %= mod_p;
    }
  }
  std::cout << sum << '\n';
}
