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