






"""simple docstring"""

def _lowerCAmelCase						(	__lowerCamelCase:int = 4_0_0_0_0_0_0 ):

						'''simple docstring'''






						if n <= 1:
												return 0
						__magic_name__      =  0
						__magic_name__      =  2
						__magic_name__      =  0
						while 4 * b + a <= n:
												__magic_name__   ,     __magic_name__      =  b, 4 * b + a
												count += a
						return count + b


if __name__ == "__main__":
			print(f'''{solution() = }''')











"""simple docstring"""

from __future__ import annotations

lowercase           =							{1: 1}






def _lowerCAmelCase						(	__lowerCamelCase:int ):

						'''simple docstring'''






						if n in COLLATZ_SEQUENCE_LENGTHS:
												return COLLATZ_SEQUENCE_LENGTHS[n]
						__magic_name__      =  n // 2 if n % 2 == 0 else 3 * n + 1
						__magic_name__      =  collatz_sequence_length(__lowerCamelCase ) + 1
						__magic_name__      =  sequence_length
						return sequence_length






def _lowerCAmelCase						(	__lowerCamelCase:int = 1_0_0_0_0_0_0 ):

						'''simple docstring'''






						__magic_name__      =  max((collatz_sequence_length(__lowerCamelCase ), i) for i in range(1			,    __lowerCamelCase ) )
						return result[1]


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



