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