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