#include <bits/stdc++.h>
using namespace std;
using ll = uint64_t;
struct key {
  ll h, l;
};
int main() {
  constexpr ll rem = 1e9 + 7;
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += (a[i] ^ a[j]) % rem;
      sum %= rem;
    }
  }
  cout << sum;
  return 0;
}
