#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[50000];
  long long int n, sum = 0, c;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++)
    for (long long j = i + 1; j < n; j++) {
      c = a[i] ^ a[j];
      sum += c;
    }
  cout << sum << endl;
}
