#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<uint64_t> vec(N + 1);
  for (int i = 1; i <= N; ++i) {
    cin >> vec[i];
  }
  uint64_t counter = 0;
  for (int i = 1; i <= N - 1; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      counter += vec[i] ^ vec[j];
    }
  }
  cout << counter % (uint64_t)(pow(10, 9.0) + 7) << endl;
  return 0;
}
