#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (auto& a : A) {
    cin >> a;
  }
  int64_t ans = 0;
  for (int64_t i = 0; i < N - 1; ++i) {
    for (int64_t j = i + 1; j < N; ++j) {
      ans += A[i] ^ A[j];
    }
  }
  constexpr int64_t C = 1e9 + 7;
  cout << ans % C << endl;
  return 0;
}
