#include <bits/stdc++.h>
using namespace std;
template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}
template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}
bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}
int main() {
  uint64_t N;
  cin >> N;
  vector<uint64_t> A(N);
  ArrayInput(A);
  uint64_t res = 0;
  for (uint64_t i = 0; i < N; ++i) {
    for (uint64_t j = i + 1; j < N; ++j) {
      res += (A[i] ^ A[j]);
      res %= 1000000007;
    }
  }
  cout << res << endl;
  return 0;
}
