"""simple docstring"""







from __future__ import annotations

UpperCamelCase_    :    List[str]											=						"""Alexander Joslin"""


def 					a__ (						UpperCAmelCase__    :     int     )->		int:

						if number <= 0:
												UpperCAmelCase__   		=						f'n must be greater than 0. Got n = {number}'
												raise ValueError(UpperCAmelCase__     )

						UpperCAmelCase__   		=						[number + 1] * (number + 1)

						# starting position
						UpperCAmelCase__   		=						0
						for i in range(1						,     UpperCAmelCase__     ):
												UpperCAmelCase__   		=						min(table[i + 1]						,     table[i] + 1     )
												# check if out of bounds
												if i * 2 <= number:
																		UpperCAmelCase__   		=						min(table[i * 2]						,     table[i] + 1     )
												# check if out of bounds
												if i * 3 <= number:
																		UpperCAmelCase__   		=						min(table[i * 3]						,     table[i] + 1     )
						return table[number]


if __name__ == "__main__":
						import doctest

						doctest.testmod()


"""simple docstring"""







from __future__ import annotations


def 					a__ (						UpperCAmelCase__    :     int     )->		list[int]:
						assert (
						    isinstance(UpperCAmelCase__						,     UpperCAmelCase__     ) and mask > 0
						), f'mask needs to be positive integer, your input {mask}'
						UpperCAmelCase__   		=						[]
						UpperCAmelCase__   		=						mask

						while submask:
												all_submasks.append(UpperCAmelCase__     )
												UpperCAmelCase__   		=						(submask - 1) & mask

						return all_submasks


if __name__ == "__main__":
						import doctest

						doctest.testmod()

