#include <bits/stdc++.h>
using namespace std;
int main() {
  uint32_t N;
  cin >> N;
  std::vector<uint64_t> As(N);
  for (auto n = 0u; n < N; ++n) {
    cin >> As[n];
  }
  uint64_t res = 0;
  for (auto i = 0u; i < N - 1; ++i) {
    for (auto j = i + 1; j < N; ++j) {
      res += As[i] ^ As[j];
      res %= 1000000007;
    }
  }
  cout << res;
}
