

'''simple docstring'''







def    UpperCAmelCase__     (   UpperCAmelCase__ = 1_00_00_00					)      ->      int:
       A_						       =   1
       A_						       =   1
       A_						       =   {1: 1}

       for inputa in range(2,							UpperCAmelCase__					):
              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())))



'''simple docstring'''







import unittest

import numpy as np
import torch

from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel
from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device


enable_full_determinism()


class        A__   (   unittest.TestCase      ):



    @property
    def        snake_case_      (       self							)    ->   int:





           '''simple docstring'''
           torch.manual_seed(0							)
           A_						       =   UNetaDModel(
               block_out_channels=(32, 64)		,					layers_per_block=2		,					sample_size=32		,					in_channels=3		,					out_channels=3		,					down_block_types=("""DownBlock2D""", """AttnDownBlock2D""")		,					up_block_types=("""AttnUpBlock2D""", """UpBlock2D""")		,					)
           return model







    def        snake_case_      (       self							)    ->   str:





           '''simple docstring'''
           A_						       =   self.dummy_uncond_unet
           A_						       =   PNDMScheduler()

           A_						       =   PNDMPipeline(unet=UpperCamelCase__		,					scheduler=UpperCamelCase__							)
           pndm.to(UpperCamelCase__							)
           pndm.set_progress_bar_config(disable=UpperCamelCase__							)

           A_						       =   torch.manual_seed(0							)
           A_						       =   pndm(generator=UpperCamelCase__		,					num_inference_steps=20		,					output_type="""numpy"""							).images

           A_						       =   torch.manual_seed(0							)
           A_						       =   pndm(generator=UpperCamelCase__		,					num_inference_steps=20		,					output_type="""numpy"""		,					return_dict=UpperCamelCase__							)[0]

           A_						       =   image[0, -3:, -3:, -1]
           A_						       =   image_from_tuple[0, -3:, -3:, -1]

           assert image.shape == (1, 32, 32, 3)
           A_						       =   np.array([1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0]							)

           assert np.abs(image_slice.flatten() - expected_slice							).max() < 1e-2
           assert np.abs(image_from_tuple_slice.flatten() - expected_slice							).max() < 1e-2


@slow
@require_torch
class        A__   (   unittest.TestCase      ):



    def        snake_case_      (       self							)    ->   Tuple:





           '''simple docstring'''
           A_						       =   """google/ddpm-cifar10-32"""

           A_						       =   UNetaDModel.from_pretrained(UpperCamelCase__							)
           A_						       =   PNDMScheduler()

           A_						       =   PNDMPipeline(unet=UpperCamelCase__		,					scheduler=UpperCamelCase__							)
           pndm.to(UpperCamelCase__							)
           pndm.set_progress_bar_config(disable=UpperCamelCase__							)
           A_						       =   torch.manual_seed(0							)
           A_						       =   pndm(generator=UpperCamelCase__		,					output_type="""numpy"""							).images

           A_						       =   image[0, -3:, -3:, -1]

           assert image.shape == (1, 32, 32, 3)
           A_						       =   np.array([0.1564, 0.14645, 0.1406, 0.14715, 0.12425, 0.14045, 0.13115, 0.12175, 0.125]							)

           assert np.abs(image_slice.flatten() - expected_slice							).max() < 1e-2
