#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll hoge(string str) {
  ll m = 0;
  for (char c : str) {
    m = (10LL * m + (c - '0')) % static_cast<long long int>(1e9 + 7);
  }
  return m;
}
int main() {
  ll n;
  cin >> n;
  vector<ll> vec(n);
  for (auto &v : vec) cin >> v;
  ll vsum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      vsum = (vsum + (vec[i] ^ vec[j])) % static_cast<ll>(1e9 + 7);
    }
  }
  cout << vsum << endl;
}
