



'''simple docstring'''







from __future__ import annotations







def  SCREAMING_SNAKE_CASE__ (				SCREAMING_SNAKE_CASE ,		SCREAMING_SNAKE_CASE     ):
		SCREAMING_SNAKE_CASE_						:str										=      [None] * (len(SCREAMING_SNAKE_CASE     ) + len(SCREAMING_SNAKE_CASE     ))

		SCREAMING_SNAKE_CASE_						:str										=      0  # pointer to current index for left Half
		SCREAMING_SNAKE_CASE_						:Any										=      0  # pointer to current index for the right Half
		SCREAMING_SNAKE_CASE_						:Any										=      0  # pointer to current index for the sorted array Half

		while pointera < len(SCREAMING_SNAKE_CASE     ) and pointera < len(SCREAMING_SNAKE_CASE     ):
				if left_half[pointera] < right_half[pointera]:
						SCREAMING_SNAKE_CASE_						:Any										=      left_half[pointera]
						pointera += 1
						index += 1
				else:
						SCREAMING_SNAKE_CASE_						:Optional[Any]										=      right_half[pointera]
						pointera += 1
						index += 1
		while pointera < len(SCREAMING_SNAKE_CASE     ):
				SCREAMING_SNAKE_CASE_						:int										=      left_half[pointera]
				pointera += 1
				index += 1

		while pointera < len(SCREAMING_SNAKE_CASE     ):
				SCREAMING_SNAKE_CASE_						:Optional[Any]										=      right_half[pointera]
				pointera += 1
				index += 1

		return sorted_array







def  SCREAMING_SNAKE_CASE__ (				SCREAMING_SNAKE_CASE     ):
		if len(SCREAMING_SNAKE_CASE     ) <= 1:
				return array
		# the actual formula to calculate the middle element = left + (right - left) // 2
		# this avoids integer overflow in case of large N
		SCREAMING_SNAKE_CASE_						:Optional[Any]										=      0 + (len(SCREAMING_SNAKE_CASE     ) - 0) // 2

		# Split the array into halves till the array length becomes equal to One
		# merge the arrays of single length returned by mergeSort function and
		# pass them into the merge arrays function which merges the array
		SCREAMING_SNAKE_CASE_						:List[str]										=      array[:middle]
		SCREAMING_SNAKE_CASE_						:List[Any]										=      array[middle:]

		return merge(merge_sort(SCREAMING_SNAKE_CASE     ) ,		merge_sort(SCREAMING_SNAKE_CASE     )     )


if __name__ == "__main__":
							import doctest

							doctest.testmod()







'''simple docstring'''

from __future__ import annotations

lowerCAmelCase__      :   Tuple      	=			{1: 1}


def 						__UpperCamelCase						(			_UpperCAmelCase  ):
		if n in COLLATZ_SEQUENCE_LENGTHS:
				return COLLATZ_SEQUENCE_LENGTHS[n]
		__UpperCAmelCase	:							int     =     n // 2 if n % 2 == 0 else 3 * n + 1
		__UpperCAmelCase	:							str     =     collatz_sequence_length(_UpperCAmelCase  ) + 1
		__UpperCAmelCase	:							Union[str, Any]     =     sequence_length
		return sequence_length


def 						__UpperCamelCase						(			_UpperCAmelCase = 1000000  ):
		__UpperCAmelCase	:							Union[str, Any]     =     max((collatz_sequence_length(_UpperCAmelCase  ), i) for i in range(1,       _UpperCAmelCase  )  )
		return result[1]


if __name__ == "__main__":
			print(solution(int(input().strip())))




