#include <bits/stdc++.h>
using namespace std;
unsigned long long a[300010];
int main() {
  unsigned long long sum = 0;
  int i, n;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  int j;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      sum += a[i] ^ a[j] % ((int)pow(10, 9) + 7);
    }
  }
  cout << sum;
  return 0;
}
