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