




"""simple docstring"""

def 				a (						__snake_case     :				Tuple,    __snake_case     :				List[Any],    __snake_case     :				int  ):



				'''simple docstring'''





				UpperCAmelCase_					:List[Any]      			=      index
				UpperCAmelCase_					:Union[str, Any]      			=      2 * index + 1
				UpperCAmelCase_					:Union[str, Any]      			=      2 * index + 2
				if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
								UpperCAmelCase_					:Optional[Any]      			=      left_index

				if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
								UpperCAmelCase_					:Optional[Any]      			=      right_index

				if largest != index:
								UpperCAmelCase_					:Dict      			=      unsorted[index], unsorted[largest]
								heapify(__snake_case,    __snake_case,    __snake_case  )



def 				a (						__snake_case     :				List[Any]  ):



				'''simple docstring'''





				UpperCAmelCase_					:Union[str, Any]      			=      len(__snake_case  )
				for i in range(n // 2 - 1,    -1,    -1  ):
								heapify(__snake_case,    __snake_case,    __snake_case  )
				for i in range(n - 1,    0,    -1  ):
								UpperCAmelCase_					:Tuple      			=      unsorted[i], unsorted[0]
								heapify(__snake_case,    0,    __snake_case  )
				return unsorted


if __name__ == "__main__":
						__lowerCamelCase								=						input("Enter numbers separated by a comma:\n").strip()
						__lowerCamelCase								=						[int(item) for item in user_input.split(",")]
						print(heap_sort(unsorted))











"""simple docstring"""

def 				a (						__snake_case     :				int  ):



				'''simple docstring'''





				if not isinstance(__snake_case,    __snake_case  ) or number < 0:
								raise ValueError('''Input must be a non-negative integer'''  )

				UpperCAmelCase_					:Optional[Any]      			=      number & ~(number - 1)
				UpperCAmelCase_					:List[str]      			=      0
				while intermediate:
								intermediate >>= 1
								index += 1
				return index - 1


if __name__ == "__main__":
						import doctest

						doctest.testmod(verbose=True)


