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