#include <bits/stdc++.h>
using namespace std;
int main(void) {
  const int Divide = (int)pow(10.0, 9.0) + 7;
  int N = 0;
  cin >> N;
  vector<long long int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long int result = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      result += a[i] ^ a[j];
    }
  }
  cout << result % Divide << endl;
  return 0;
}
