#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[n], k = 0, b[n], i, j;
  int temp = 0, binaryNum[n][32];
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  b[i] = a[i];
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) temp += a[i] ^ a[j];
  }
  printf("%d", temp);
  return 0;
}
