#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int sum = 0;
  vector<int> v(t);
  for (int i = 0; i < t; ++i) {
    cin >> v[i];
  }
  for (int i = 0; i < t; ++i) {
    for (int j = i + 1; j < t; j++) {
      sum += +v[i] ^ v[j];
    }
  }
  cout << sum;
}
