#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  ll n, s = 0;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      s += a[i] ^ a[j];
    }
  }
  cout << s << endl;
  return 0;
}
