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