#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[]) {
  uint64_t N;
  cin >> N;
  uint64_t *A = new uint64_t[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  const uint64_t div = 1000000000 + 7;
  uint64_t ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += A[i] ^ A[j];
      ans = ans % div;
    }
  }
  cout << ans << endl;
  delete[] A;
  return 0;
}
