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

def determineResult(num, num_arr, counter, result, length):
  if counter > length:
    print(result)
    return

  for num2 in num_arr[counter:]:
    result += getXor(int(num), int(num2))

  old_count = counter
  counter += 1
  determineResult(num_arr[old_count], num_arr, counter, result, length)

if __name__ == "__main__":
    count = int(input())
    num_string = input()
    num_arr = num_string.split()
    determineResult(num_arr[0], num_arr, 1, 0, count-1)