#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned int N;
  unsigned long ans = 0;
  cin >> N;
  vector<unsigned long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += (A.at(i) ^ A.at(j)) % (1000000000 + 7);
    }
  }
  cout << ans << endl;
  return 0;
}
