


'''simple docstring'''







# limitations under the License.


from typing import Optional, Tuple, Union

import torch

from diffusers import DiffusionPipeline, ImagePipelineOutput


class  lowerCAmelCase_						(       snake_case__      ):





  """simple docstring"""



  def __init__(					self     :							Optional[int]				,							SCREAMING_SNAKE_CASE__     :							int				,							SCREAMING_SNAKE_CASE__     :							Optional[int]						):





       '''simple docstring'''

       super().__init__()
       self.register_modules(unet=SCREAMING_SNAKE_CASE__				,							scheduler=SCREAMING_SNAKE_CASE__						)


  @torch.no_grad()
  def __call__(					self     :							List[str]				,							SCREAMING_SNAKE_CASE__     :							int = 1				,							SCREAMING_SNAKE_CASE__     :							Optional[torch.Generator] = None				,							SCREAMING_SNAKE_CASE__     :							int = 5_0				,							SCREAMING_SNAKE_CASE__     :							Optional[str] = "pil"				,							SCREAMING_SNAKE_CASE__     :							bool = True				,							**SCREAMING_SNAKE_CASE__     :							List[str]				,							):





       '''simple docstring'''

       __a       =   torch.randn(
           (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)				,							generator=SCREAMING_SNAKE_CASE__				,							)
       __a       =   image.to(self.device						)

       # set step values
       self.scheduler.set_timesteps(SCREAMING_SNAKE_CASE__						)

       for t in self.progress_bar(self.scheduler.timesteps						):
            # 1. predict noise model_output
            __a       =   self.unet(SCREAMING_SNAKE_CASE__				,							SCREAMING_SNAKE_CASE__						).sample

            # 2. predict previous mean of image x_t-1 and add variance depending on eta
            # eta corresponds to η in paper and should be between [0, 1]
            # do x_t -> x_t-1
            __a       =   self.scheduler.step(SCREAMING_SNAKE_CASE__				,							SCREAMING_SNAKE_CASE__				,							SCREAMING_SNAKE_CASE__						).prev_sample

       __a       =   (image / 2 + 0.5).clamp(0				,							1						)
       __a       =   image.cpu().permute(0				,							2				,							3				,							1						).numpy()
       if output_type == "pil":
            __a       =   self.numpy_to_pil(SCREAMING_SNAKE_CASE__						)

       if not return_dict:
            return (image,), "This is a local test"

       return ImagePipelineOutput(images=SCREAMING_SNAKE_CASE__						), "This is a local test"










'''simple docstring'''







def        __lowercase						(      __SCREAMING_SNAKE_CASE = 100_0000		)				->					int:
     """simple docstring"""




     __a       =   1
     __a       =   1
     __a       =   {1: 1}

     for inputa in range(2				,  __SCREAMING_SNAKE_CASE		):
          __a       =   0
          __a       =   inputa

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

          if inputa not in counters:
               __a       =   counter

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


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






