



"""simple docstring"""






class 			A__   :




	'''simple docstring'''





	def __init__(     self:		Any       ,			_SCREAMING_SNAKE_CASE:		int)				->       Union[str, Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[Any]												=       n
				__lowerCAmelCase      :  List[Any]												=       [None] * self.n
				__lowerCAmelCase      :  int												=       0  # index of the first element
				__lowerCAmelCase      :  Tuple												=       0
				__lowerCAmelCase      :  Any												=       0

	def __len__(     self:		Dict)				->       int:

				"""simple docstring"""

				return self.size

	def 							_SCREAMING_SNAKE_CASE   (     self:		List[str])				->       bool:

				"""simple docstring"""

				return self.size == 0

	def 							_SCREAMING_SNAKE_CASE   (     self:		List[Any])				->       List[str]:

				"""simple docstring"""

				return False if self.is_empty() else self.array[self.front]

	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[Any]       ,			_SCREAMING_SNAKE_CASE:		List[Any])				->       Tuple:

				"""simple docstring"""

				if self.size >= self.n:
							raise Exception("QUEUE IS FULL")

				__lowerCAmelCase      :  Optional[Any]												=       data
				__lowerCAmelCase      :  Tuple												=       (self.rear + 1) % self.n
				self.size += 1
				return self







	def 							_SCREAMING_SNAKE_CASE   (     self:		Any)				->       int:

				"""simple docstring"""

				if self.size == 0:
							raise Exception("UNDERFLOW")

				__lowerCAmelCase      :  Any												=       self.array[self.front]
				__lowerCAmelCase      :  int												=       None
				__lowerCAmelCase      :  Union[str, Any]												=       (self.front + 1) % self.n
				self.size -= 1
				return temp




"""simple docstring"""






from __future__ import annotations


def 			_lowercase				(  __snake_case					,__snake_case					,__snake_case					,__snake_case	)						->   list:
			__lowerCAmelCase      :  Dict												=       []
			__lowerCAmelCase						,	__lowerCAmelCase      :  Any												=       input_list[low:mid], input_list[mid : high + 1]
			while left and right:
						result.append((left if left[0] <= right[0] else right).pop(0	)	)
			__lowerCAmelCase      :  int												=       result + left + right
			return input_list


def 			_lowercase				(  __snake_case	)						->   list:
			if len(__snake_case	) <= 1:
						return input_list
			__lowerCAmelCase      :  int												=       list(__snake_case	)

			# iteration for two-way merging
			__lowerCAmelCase      :  Optional[int]												=       2
			while p <= len(__snake_case	):
						# getting low, high and middle value for merge-sort of single list
						for i in range(0					,len(__snake_case	)					,__snake_case	):
									__lowerCAmelCase      :  Union[str, Any]												=       i
									__lowerCAmelCase      :  Tuple												=       i + p - 1
									__lowerCAmelCase      :  Optional[Any]												=       (low + high + 1) // 2
									__lowerCAmelCase      :  Any												=       merge(__snake_case					,__snake_case					,__snake_case					,__snake_case	)
						# final merge of last two parts
						if p * 2 >= len(__snake_case	):
									__lowerCAmelCase      :  Optional[Any]												=       i
									__lowerCAmelCase      :  Union[str, Any]												=       merge(__snake_case					,0					,__snake_case					,len(__snake_case	) - 1	)
									break
						p *= 2

			return input_list


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