#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A;
  long div = pow(10, 9) + 7;
  string buf;
  while (getline(cin, buf, ' ')) {
    A.push_back(atol(buf.c_str()));
  }
  long long sum = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      sum += A[i] ^ A[j];
    }
  }
  cout << sum % div << endl;
  return 0;
}
