def getXor(x, y): 
    return ((x | y) & (~x | ~y))

def determineResult(num_string):
  num_arr = num_string.split()
  count = 1
  result = 0
  for num in num_arr:
    for num2 in num_arr[count:]:
      print("Num: " + num + " Num2: " + num2)
      result += getXor(int(num), int(num2))
    count += 1
  print(result)

if __name__ == "__main__":
    count = input()
    num_string = input()
    determineResult(num_string)