



import importlib.metadata
import subprocess
import sys



def  _lowerCAmelCase     (_lowerCAmelCase = False):
					UpperCamelCase_			= False
					if "IPython" in sys.modules:
										UpperCamelCase_			= "google.colab" in str(sys.modules["IPython"].get_ipython())

					if in_colab:
										if upgrade:
															UpperCamelCase_			= ["pip", "install", "-U", "torch"]
															subprocess.run(_lowerCAmelCase ,						check=_lowerCAmelCase)
										# get the current version of torch
										UpperCamelCase_			= importlib.metadata.version("torch")
										UpperCamelCase_			= torch_version[: torch_version.rindex(".")]
										UpperCamelCase_			= f"""https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl"""
										UpperCamelCase_			= ["pip", "install", xla_wheel]
										subprocess.run(_lowerCAmelCase ,						check=_lowerCAmelCase)
					else:
										raise RuntimeError("`install_xla` utility works only on google colab.")







'''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())))




