


# limitations under the License.


from typing import Optional, Tuple, Union

import torch

from diffusers import DiffusionPipeline, ImagePipelineOutput







class 				snake_case__(							UpperCAmelCase__							):







						'''simple docstring'''




						def __init__(				self   ,						__lowercase   ,						__lowercase							)					->    Optional[Any]:
										super().__init__()
										self.register_modules(unet=__lowercase   ,						scheduler=__lowercase							)




						@torch.no_grad()
						def __call__(				self   ,						__lowercase = 1   ,						__lowercase = None   ,						__lowercase = 5_0   ,						__lowercase = "pil"   ,						__lowercase = True   ,						**__lowercase   ,						)					->    Union[ImagePipelineOutput, Tuple]:
										lowerCAmelCase_ :      Optional[Any]    				=				torch.randn(
										    (batch_size, self.unet.config.in_channels, self.unet.config.sample_size, self.unet.config.sample_size)   ,						generator=__lowercase   ,						)
										lowerCAmelCase_ :      Union[str, Any]    				=				image.to(self.device							)

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

										for t in self.progress_bar(self.scheduler.timesteps							):
														# 1. predict noise model_output
														lowerCAmelCase_ :      Union[str, Any]    				=				self.unet(__lowercase   ,						__lowercase							).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
														lowerCAmelCase_ :      Tuple    				=				self.scheduler.step(__lowercase   ,						__lowercase   ,						__lowercase							).prev_sample

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

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

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



def 			lowerCAmelCase (		lowerCAmelCase_ = 1_000_000 )-> int:
				lowerCAmelCase_ :      Dict    				=				1
				lowerCAmelCase_ :      List[Any]    				=				1
				lowerCAmelCase_ :      Optional[Any]    				=				{1: 1}

				for inputa in range(2 ,   lowerCAmelCase_ ):
								lowerCAmelCase_ :      Tuple    				=				0
								lowerCAmelCase_ :      Dict    				=				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_ :      Optional[int]    				=				inputa
												lowerCAmelCase_ :      Union[str, Any]    				=				counter
				return largest_number


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