"""simple docstring"""







def 						_lowercase				(  _SCREAMING_SNAKE_CASE				:				str  ,       _SCREAMING_SNAKE_CASE				:				List[Any]  ,       _SCREAMING_SNAKE_CASE				:				Tuple						)    ->     List[str]:







     '''simple docstring'''


     __A					:					List[str]								=		index
     __A					:					Dict								=		2 * index + 1
     __A					:					str								=		2 * index + 2
     if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
          __A					:					int								=		left_index

     if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
          __A					:					Optional[int]								=		right_index

     if largest != index:
          __A						,		__A					:					Dict								=		unsorted[index], unsorted[largest]
          heapify(_SCREAMING_SNAKE_CASE  ,       _SCREAMING_SNAKE_CASE  ,       _SCREAMING_SNAKE_CASE						)




def 						_lowercase				(  _SCREAMING_SNAKE_CASE				:				Optional[int]						)    ->     str:







     '''simple docstring'''


     __A					:					List[Any]								=		len(_SCREAMING_SNAKE_CASE						)
     for i in range(n // 2 - 1  ,       -1  ,       -1						):
          heapify(_SCREAMING_SNAKE_CASE  ,       _SCREAMING_SNAKE_CASE  ,       _SCREAMING_SNAKE_CASE						)
     for i in range(n - 1  ,       0  ,       -1						):
          __A						,		__A					:					Dict								=		unsorted[i], unsorted[0]
          heapify(_SCREAMING_SNAKE_CASE  ,       0  ,       _SCREAMING_SNAKE_CASE						)
     return unsorted


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




"""simple docstring"""







def 						_lowercase				(  _SCREAMING_SNAKE_CASE				:				list[int]						)    ->     int:







     '''simple docstring'''


     if not isinstance(_SCREAMING_SNAKE_CASE  ,       _SCREAMING_SNAKE_CASE						) or not all(
         isinstance(_SCREAMING_SNAKE_CASE  ,       _SCREAMING_SNAKE_CASE						) and item >= 0 for item in citations						):
          raise ValueError('The citations should be a list of non negative integers.'						)

     citations.sort()
     __A					:					Any								=		len(_SCREAMING_SNAKE_CASE						)

     for i in range(_SCREAMING_SNAKE_CASE						):
          if citations[len_citations - 1 - i] <= i:
               return i

     return len_citations


if __name__ == "__main__":
       import doctest

       doctest.testmod()



