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