





import random




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     Optional[Any]:
  lowercase__			    =						a[left_index]
  lowercase__			    =						left_index + 1
  for j in range(left_index + 1	,		_SCREAMING_SNAKE_CASE	):
    if a[j] < pivot:
      lowercase__    ,					lowercase__			    =						a[i], a[j]
      i += 1
  lowercase__    ,					lowercase__			    =						a[i - 1], a[left_index]
  return i - 1




def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)       ->     Optional[Any]:
  if left < right:
    lowercase__			    =						random.randint(_SCREAMING_SNAKE_CASE	,		right - 1	)
    lowercase__    ,					lowercase__			    =						(
        a[left],
        a[pivot],
    )  # switches the pivot with the left most bound
    lowercase__			    =						partition(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)
    quick_sort_random(
        _SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	)  # recursive quicksort to the left of the pivot point
    quick_sort_random(
        _SCREAMING_SNAKE_CASE	,		pivot_index + 1	,		_SCREAMING_SNAKE_CASE	)  # recursive quicksort to the right of the pivot point




def     __UpperCamelCase						()       ->     Dict:
  lowercase__			    =						input('Enter numbers separated by a comma:\n'	).strip()
  lowercase__			    =						[int(_SCREAMING_SNAKE_CASE	) for item in user_input.split(','	)]

  quick_sort_random(_SCREAMING_SNAKE_CASE	,		0	,		len(_SCREAMING_SNAKE_CASE	)	)

  print(_SCREAMING_SNAKE_CASE	)


if __name__ == "__main__":
      main()








class        SCREAMING_SNAKE_CASE     :  # Public class to implement a graph


   def __init__(					self    :       int    ,  a    :       int    ,  a    :       int    ,  a    :       list[list[bool]] )->     None:





     """simple docstring"""







     lowercase__			    =						row
     lowercase__			    =						col
     lowercase__			    =						graph


   def  SCREAMING_SNAKE_CASE_							(					self    :       Dict    ,  a    :       int    ,  a    :       int    ,  a    :       list[list[bool]] )->     bool:





     """simple docstring"""







     return (
         0 <= i < self.ROW
         and 0 <= j < self.COL
         and not visited[i][j]
         and self.graph[i][j]
     )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[str]    ,  a    :       int    ,  a    :       int    ,  a    :       list[list[bool]] )->     None:





     """simple docstring"""







     lowercase__			    =						[-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
     lowercase__			    =						[-1, 0, 1, -1, 1, -1, 0, 1]
     lowercase__			    =						True  # Make those cells visited
     for k in range(8 ):
       if self.is_safe(i + row_nbr[k]    ,  j + col_nbr[k]    ,  a ):
         self.diffs(i + row_nbr[k]    ,  j + col_nbr[k]    ,  a )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[str] )->     int:  # And finally, count all islands.





     """simple docstring"""







     lowercase__			    =						[[False for j in range(self.COL )] for i in range(self.ROW )]
     lowercase__			    =						0
     for i in range(self.ROW ):
       for j in range(self.COL ):
         if visited[i][j] is False and self.graph[i][j] == 1:
           self.diffs(a    ,  a    ,  a )
           count += 1
     return count


