#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;
int main() {
  ull mod = pow(10, 9) + 7;
  uint N;
  cin >> N;
  vector<ull> A(N);
  for (uint i = 0; i < N; i++) {
    cin >> A[i];
  }
  ull ans = 0;
  for (uint i = 0; i < N; i++) {
    for (uint j = i + 1; j < N; j++) {
      ans = (ans + (A[i] ^ A[j])) % mod;
    }
  }
  cout << ans;
  return 0;
}
