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