#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  int N;
  int mod = pow(10, 9) + 7;
  map<int, int> A;
  int sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += (A[i] xor A[j]) % mod;
    }
  }
  cout << sum << endl;
}
