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