



def 	__lowercase   ( a__   )				-> str:
							__SCREAMING_SNAKE_CASE									=					0
							__SCREAMING_SNAKE_CASE									=					len(lowerCAmelCase_   )

							for i in range(n - 1   ):
														for j in range(i + 1							,   lowerCAmelCase_   ):
																					if arr[i] > arr[j]:
																												num_inversions += 1

							return num_inversions






def 	__lowercase   ( a__   )				-> str:
							if len(lowerCAmelCase_   ) <= 1:
														return arr, 0
							__SCREAMING_SNAKE_CASE									=					len(lowerCAmelCase_   ) // 2
							__SCREAMING_SNAKE_CASE									=					arr[0:mid]
							__SCREAMING_SNAKE_CASE									=					arr[mid:]

							__SCREAMING_SNAKE_CASE									=					count_inversions_recursive(lowerCAmelCase_   )
							__SCREAMING_SNAKE_CASE									=					count_inversions_recursive(lowerCAmelCase_   )
							__SCREAMING_SNAKE_CASE									=					_count_cross_inversions(lowerCAmelCase_							,   lowerCAmelCase_   )

							__SCREAMING_SNAKE_CASE									=					inversion_p + inversions_q + cross_inversions
							return c, num_inversions






def 	__lowercase   ( a__							,   a__   )				-> Union[str, Any]:
							__SCREAMING_SNAKE_CASE									=					[]
							__SCREAMING_SNAKE_CASE									=					0
							while i < len(lowerCAmelCase_   ) and j < len(lowerCAmelCase_   ):
														if p[i] > q[j]:
																					# if P[1] > Q[j], then P[k] > Q[k] for all  i < k <= len(P)
																					# These are all inversions. The claim emerges from the
																					# property that P is sorted.
																					num_inversion += len(lowerCAmelCase_   ) - i
																					r.append(q[j]   )
																					j += 1
														else:
																					r.append(p[i]   )
																					i += 1

							if i < len(lowerCAmelCase_   ):
														r.extend(p[i:]   )
							else:
														r.extend(q[j:]   )

							return r, num_inversion






def 	__lowercase   ( )				-> Optional[int]:
							__SCREAMING_SNAKE_CASE									=					[10, 2, 1, 5, 5, 2, 11]

							# this arr has 8 inversions:
							# (10, 2), (10, 1), (10, 5), (10, 5), (10, 2), (2, 1), (5, 2), (5, 2)

							__SCREAMING_SNAKE_CASE									=					count_inversions_bf(lowerCAmelCase_   )
							__SCREAMING_SNAKE_CASE									=					count_inversions_recursive(lowerCAmelCase_   )

							assert num_inversions_bf == num_inversions_recursive == 8

							print('number of inversions = '							,   lowerCAmelCase_   )

							# testing an array with zero inversion (a sorted arr_1)

							arr_a.sort()
							__SCREAMING_SNAKE_CASE									=					count_inversions_bf(lowerCAmelCase_   )
							__SCREAMING_SNAKE_CASE									=					count_inversions_recursive(lowerCAmelCase_   )

							assert num_inversions_bf == num_inversions_recursive == 0
							print('number of inversions = '							,   lowerCAmelCase_   )

							# an empty list should also have zero inversions
							__SCREAMING_SNAKE_CASE									=					[]
							__SCREAMING_SNAKE_CASE									=					count_inversions_bf(lowerCAmelCase_   )
							__SCREAMING_SNAKE_CASE									=					count_inversions_recursive(lowerCAmelCase_   )

							assert num_inversions_bf == num_inversions_recursive == 0
							print('number of inversions = '							,   lowerCAmelCase_   )


if __name__ == "__main__":
			main()














def 					snake_case_						(   lowerCAmelCase_				:  list					):

							if len(lowerCAmelCase_					) <= 1:
														return [tuple(lowerCAmelCase_					)]

							__lowercase					:							Any			=   []

							def generate(lowerCAmelCase_				:  int				,				lowerCAmelCase_				:  list					):
														if k == 1:
																					res.append(tuple(arr[:]					)					)
																					return

														generate(k - 1				,				lowerCAmelCase_					)

														for i in range(k - 1					):
																					if k % 2 == 0:  # k is even
																												__lowercase	,	__lowercase					:							List[str]			=   arr[k - 1], arr[i]
																					else:  # k is odd
																												__lowercase	,	__lowercase					:							Any			=   arr[k - 1], arr[0]
																					generate(k - 1				,				lowerCAmelCase_					)

							generate(len(lowerCAmelCase_					)				,				lowerCAmelCase_					)
							return res


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