#include <bits/stdc++.h>

using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long a[n] = {0};

  for (int i = 0; i < n; i++) {
    cin >> a[n];
  }

  unsigned long long result = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; j < n; j++) {
      result += a[i] ^ a[j];
    }
  }
  cout << result << endl;

  return 0;
}