





UpperCAmelCase_      							=     [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)]





def 						lowerCamelCase__     (     UpperCamelCase__			:       int						)			-> int:



					'''simple docstring'''




					_snake_case									=				0
					while number:
										# Increased Speed Slightly by checking every 5 digits together.
										sum_of_digits_squared += DIGITS_SQUARED[number % 100_000]
										number //= 100_000

					return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
UpperCAmelCase_      							=     [None] * 10000000
UpperCAmelCase_      							=     True
UpperCAmelCase_      							=     False





def 						lowerCamelCase__     (     UpperCamelCase__			:       int						)			-> bool:



					'''simple docstring'''




					if CHAINS[number - 1] is not None:
										return CHAINS[number - 1]  # type: ignore

					_snake_case									=				chain(next_number(UpperCamelCase__						)						)
					_snake_case									=				number_chain

					while number < 10_000_000:
										_snake_case									=				number_chain
										number *= 10

					return number_chain





def 						lowerCamelCase__     (     UpperCamelCase__			:       int = 10_000_000						)			-> int:



					'''simple docstring'''




					for i in range(1       ,    UpperCamelCase__						):
										if CHAINS[i] is None:
															chain(i + 1						)

					return CHAINS[:number].count(UpperCamelCase__						)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					print(F"{solution() = }")










def 						lowerCamelCase__     (     UpperCamelCase__			:       list						)			-> list:



					'''simple docstring'''




					_snake_case									=				len(UpperCamelCase__						)
					for i in range(1       ,    UpperCamelCase__						):
										_snake_case									=				collection[i]
										_snake_case									=				0
										_snake_case									=				i - 1

										while low <= high:
															_snake_case									=				(low + high) // 2
															if val < collection[mid]:
																				_snake_case									=				mid - 1
															else:
																				_snake_case									=				mid + 1
										for j in range(UpperCamelCase__       ,    UpperCamelCase__       ,    -1						):
															_snake_case									=				collection[j - 1]
										_snake_case									=				val
					return collection


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



