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