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