






'''simple docstring'''
import inspect
from typing import List, Optional, Tuple, Union

import torch

from ...models import UNetaDModel, VQModel
from ...schedulers import DDIMScheduler
from ...utils import randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput






class    __SCREAMING_SNAKE_CASE					(	lowerCamelCase ):




 def __init__(					self		:							List[Any]    ,					__lowercase		:							int    ,					__lowercase		:							Dict    ,					__lowercase		:							Union[str, Any]					)		->  Any:
       super().__init__()
       self.register_modules(vqvae=__lowercase    ,					unet=__lowercase    ,					scheduler=__lowercase					)




 @torch.no_grad()
 def __call__(					self		:							Optional[Any]    ,					__lowercase		:							List[Any] = 1    ,					__lowercase		:							Any = None    ,					__lowercase		:							Any = 0.0    ,					__lowercase		:							Optional[int] = 50    ,					__lowercase		:							Optional[int] = "pil"    ,					__lowercase		:							List[str] = True    ,					**__lowercase		:							List[Any]    ,					)		->  Union[Tuple, ImagePipelineOutput]:
       SCREAMING_SNAKE_CASE__   : Dict													=randn_tensor(
           (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)    ,					generator=__lowercase    ,					)
       SCREAMING_SNAKE_CASE__   : Optional[int]													=latents.to(self.device					)

       # scale the initial noise by the standard deviation required by the scheduler
       SCREAMING_SNAKE_CASE__   : Any													=latents * self.scheduler.init_noise_sigma

       self.scheduler.set_timesteps(__lowercase					)

       # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
       SCREAMING_SNAKE_CASE__   : Optional[Any]													='''eta''' in set(inspect.signature(self.scheduler.step					).parameters.keys()					)

       SCREAMING_SNAKE_CASE__   : Dict													={}
       if accepts_eta:
             SCREAMING_SNAKE_CASE__   : List[Any]													=eta

       for t in self.progress_bar(self.scheduler.timesteps					):
             SCREAMING_SNAKE_CASE__   : int													=self.scheduler.scale_model_input(__lowercase    ,					__lowercase					)
             # predict the noise residual
             SCREAMING_SNAKE_CASE__   : Optional[Any]													=self.unet(__lowercase    ,					__lowercase					).sample
             # compute the previous noisy sample x_t -> x_t-1
             SCREAMING_SNAKE_CASE__   : List[Any]													=self.scheduler.step(__lowercase    ,					__lowercase    ,					__lowercase    ,					**__lowercase					).prev_sample

       # decode the image latents with the VAE
       SCREAMING_SNAKE_CASE__   : str													=self.vqvae.decode(__lowercase					).sample

       SCREAMING_SNAKE_CASE__   : Tuple													=(image / 2 + 0.5).clamp(0    ,					1					)
       SCREAMING_SNAKE_CASE__   : Optional[Any]													=image.cpu().permute(0    ,					2    ,					3    ,					1					).numpy()
       if output_type == "pil":
             SCREAMING_SNAKE_CASE__   : Optional[Any]													=self.numpy_to_pil(__lowercase					)

       if not return_dict:
             return (image,)

       return ImagePipelineOutput(images=__lowercase					)


def      a      (			A__	:   int = 1000000     )    ->      int:





      """simple docstring"""



      _lowercase	       =1
      _lowercase	       =1
      _lowercase	       ={1: 1}

      for inputa in range(2      ,   A__     ):
            _lowercase	       =0
            _lowercase	       =inputa

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

            if inputa not in counters:
                  _lowercase	       =counter

            if counter > pre_counter:
                  _lowercase	       =inputa
                  _lowercase	       =counter
      return largest_number


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


