#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, M, O, P, count = 0, Amax = 0, imin = 0, Amin = 0;
  double d;
  string S;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < N; i++) cin >> A[i];
  for (long long i = 0; i < N - 1; i++)
    for (long long j = i + 1; j < N; j++) {
      count += A[i] ^ A[j];
    }
  cout << count % 1000000007 << endl;
}
