






"""simple docstring"""

from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
			import torch

lowercase           =							logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
			from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):






			def _lowerCAmelCase						(	cls:List[Any] ):

									'''simple docstring'''






									return cls






def _lowerCAmelCase						(	__lowerCamelCase:Union[Tuple, List]			,    __lowerCamelCase:Optional[Union[List["torch.Generator"], "torch.Generator"]] = None			,    __lowerCamelCase:Optional["torch.device"] = None			,    __lowerCamelCase:Optional["torch.dtype"] = None			,    __lowerCamelCase:Optional["torch.layout"] = None			,    ):

						'''simple docstring'''






						__magic_name__      =  device
						__magic_name__      =  shape[0]

						__magic_name__      =  layout or torch.strided
						__magic_name__      =  device or torch.device("cpu" )

						if generator is not None:
												__magic_name__      =  generator.device.type if not isinstance(__lowerCamelCase			,    __lowerCamelCase ) else generator[0].device.type
												if gen_device_type != device.type and gen_device_type == "cpu":
																		__magic_name__      =  "cpu"
																		if device != "mps":
																								logger.info(
																								    f'''The passed generator was created on \'cpu\' even though a tensor on {device} was expected.'''
																								    f''' Tensors will be created on \'cpu\' and then moved to {device}. Note that one can probably'''
																								    f''' slighly speed up this function by passing a generator that was created on the {device} device.''' )
												elif gen_device_type != device.type and gen_device_type == "cuda":
																		raise ValueError(f'''Cannot generate a {device} tensor from a generator of type {gen_device_type}.''' )

						if isinstance(__lowerCamelCase			,    __lowerCamelCase ):
												__magic_name__      =  (1,) + shape[1:]
												__magic_name__      =  [
												    torch.randn(__lowerCamelCase			,    generator=generator[i]			,    device=__lowerCamelCase			,    dtype=__lowerCamelCase			,    layout=__lowerCamelCase )
												    for i in range(__lowerCamelCase )
												]
												__magic_name__      =  torch.cat(__lowerCamelCase			,    dim=0 ).to(__lowerCamelCase )
						else:
												__magic_name__      =  torch.randn(__lowerCamelCase			,    generator=__lowerCamelCase			,    device=__lowerCamelCase			,    dtype=__lowerCamelCase			,    layout=__lowerCamelCase ).to(__lowerCamelCase )

						return latents






def _lowerCAmelCase						(	__lowerCamelCase:Any ):

						'''simple docstring'''






						if is_torch_version("<"			,    "2.0.0" ) or not hasattr(__lowerCamelCase			,    "_dynamo" ):
												return False
						return isinstance(__lowerCamelCase			,    torch._dynamo.eval_frame.OptimizedModule )











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



