#include <bits/stdc++.h>
int main() {
  unsigned long long a = 1;
  unsigned long long b = 2;
  int n, i, j;
  unsigned long long sum = 0;
  int c[100];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%llu", &a);
    c[i] = a;
  }
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      sum += c[i] ^ c[j];
    }
  }
  printf("%llu", sum);
  return 0;
}
