



'''simple docstring'''





import copy
from typing import Dict, Optional

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
from ..detr import DetrConfig
from ..swin import SwinConfig


_snake_case	=						{
    "facebook/maskformer-swin-base-ade": (
        "https://huggingface.co/facebook/maskformer-swin-base-ade/blob/main/config.json"
    )
    # See all MaskFormer models at https://huggingface.co/models?filter=maskformer
}

_snake_case	=						logging.get_logger(__name__)



class 						UpperCAmelCase_					( _UpperCAmelCase):
							lowerCamelCase__         =	'''maskformer'''
							lowerCamelCase__         =	{'''hidden_size''': '''mask_feature_size'''}
							lowerCamelCase__         =	['''resnet''', '''swin''']
							lowerCamelCase__         =	['''detr''']







							def __init__(     self,    __a = 256,    __a = 256,    __a = 0.1,    __a = False,    __a = None,    __a = None,    __a = 0.02,    __a = 1.0,    __a = 1.0,    __a = 1.0,    __a = 20.0,    __a = None,    **__a,    ):

														'''simple docstring'''

														if backbone_config is None:
																					# fall back to https://huggingface.co/microsoft/swin-base-patch4-window12-384-in22k
																					_lowerCAmelCase  :							Optional[Any]				     =					SwinConfig(
																					    image_size=384,    in_channels=3,    patch_size=4,    embed_dim=128,    depths=[2, 2, 18, 2],    num_heads=[4, 8, 16, 32],    window_size=12,    drop_path_rate=0.3,    out_features=["stage1", "stage2", "stage3", "stage4"],    )

														if isinstance(A_,    A_):
																					_lowerCAmelCase  :							Optional[Any]				     =					backbone_config.pop("model_type")
																					_lowerCAmelCase  :							Optional[Any]				     =					CONFIG_MAPPING[backbone_model_type]
																					_lowerCAmelCase  :							Optional[int]				     =					config_class.from_dict(A_)

														# verify that the backbone is supported
														if backbone_config.model_type not in self.backbones_supported:
																					logger.warning_once(
																					    f"Backbone {backbone_config.model_type} is not a supported model and may not be compatible with MaskFormer. "
																					    f"Supported model types: {','.join(self.backbones_supported)}")

														if decoder_config is None:
																					# fall back to https://huggingface.co/facebook/detr-resnet-50
																					_lowerCAmelCase  :							List[str]				     =					DetrConfig()
														else:
																					# verify that the decoder is supported
																					_lowerCAmelCase  :							Any				     =					(
																					    decoder_config.pop("model_type") if isinstance(A_,    A_) else decoder_config.model_type
																					)
																					if decoder_type not in self.decoders_supported:
																												raise ValueError(
																												    f"Transformer Decoder {decoder_type} not supported, please use one of"
																												    f" {','.join(self.decoders_supported)}")
																					if isinstance(A_,    A_):
																												_lowerCAmelCase  :							Tuple				     =					CONFIG_MAPPING[decoder_type]
																												_lowerCAmelCase  :							str				     =					config_class.from_dict(A_)

														_lowerCAmelCase  :							Optional[Any]				     =					backbone_config
														_lowerCAmelCase  :							List[Any]				     =					decoder_config
														# main feature dimension for the model
														_lowerCAmelCase  :							Union[str, Any]				     =					fpn_feature_size
														_lowerCAmelCase  :							Union[str, Any]				     =					mask_feature_size
														# initializer
														_lowerCAmelCase  :							Any				     =					init_std
														_lowerCAmelCase  :							Optional[Any]				     =					init_xavier_std
														# Hungarian matcher && loss
														_lowerCAmelCase  :							Any				     =					cross_entropy_weight
														_lowerCAmelCase  :							int				     =					dice_weight
														_lowerCAmelCase  :							Union[str, Any]				     =					mask_weight
														_lowerCAmelCase  :							int				     =					use_auxiliary_loss
														_lowerCAmelCase  :							Tuple				     =					no_object_weight
														_lowerCAmelCase  :							Union[str, Any]				     =					output_auxiliary_logits

														_lowerCAmelCase  :							str				     =					self.decoder_config.encoder_attention_heads
														_lowerCAmelCase  :							Tuple				     =					self.decoder_config.num_hidden_layers
														super().__init__(**A_)







							@classmethod
							def      snake_case__   (     cls,    __a,    __a,    **__a):

														'''simple docstring'''

														return cls(
														    backbone_config=A_,    decoder_config=A_,    **A_,    )







							def      snake_case__   (     self):

														'''simple docstring'''

														_lowerCAmelCase  :							List[Any]				     =					copy.deepcopy(self.__dict__)
														_lowerCAmelCase  :							List[str]				     =					self.backbone_config.to_dict()
														_lowerCAmelCase  :							List[str]				     =					self.decoder_config.to_dict()
														_lowerCAmelCase  :							Optional[int]				     =					self.__class__.model_type
														return output





def        A       (      _lowerCamelCase = 1_000_000						):





							'''simple docstring'''




							_lowerCAmelCase  :							Any				     =					1
							_lowerCAmelCase  :							Optional[Any]				     =					1
							_lowerCAmelCase  :							List[str]				     =					{1: 1}

							for inputa in range(2       ,				_lowerCamelCase						):
														_lowerCAmelCase  :							int				     =					0
														_lowerCAmelCase  :							Any				     =					inputa

														while True:
																					if number in counters:
																												counter += counters[number]
																												break
																					if number % 2 == 0:
																												number //= 2
																												counter += 1
																					else:
																												_lowerCAmelCase  :							Any				     =					(3 * number) + 1
																												counter += 1

														if inputa not in counters:
																					_lowerCAmelCase  :							Tuple				     =					counter

														if counter > pre_counter:
																					_lowerCAmelCase  :							Union[str, Any]				     =					inputa
																					_lowerCAmelCase  :							Union[str, Any]				     =					counter
							return largest_number


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