#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int A = 0, N;
  uint64_t x;
  vector<uint64_t> y;
  cin >> N;
  while (cin >> x) y.push_back(x);
  for (int i = 0; i < (int)N; i++)
    for (int j = 0; j < (int)N; j++) {
      if (i <= j) continue;
      A += (y.at(i) ^ y.at(j)) % MOD, A %= MOD;
    }
  return cout << A << endl, 0;
}
