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