






"""simple docstring"""



def 						lowercase    (				__snake_case				: Dict = 1_0_0_0_0_0_0	):
		lowercase_ : Any							       =   1
		lowercase_ : Any							       =   1
		lowercase_ : str							       =   {1: 1}

		for inputa in range(2		,					_A	):
				lowercase_ : Optional[int]							       =   0
				lowercase_ : List[str]							       =   inputa

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

				if inputa not in counters:
						lowercase_ : Dict							       =   counter

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


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









import unittest

from transformers import is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_vision, slow, torch_device


if is_torch_available():
						import torch

						from transformers import AutoModelForImageClassification

if is_vision_available():
						from transformers import AutoImageProcessor


@require_torch
@require_vision
class  A		(  unittest.TestCase     ):



		@slow
		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  AutoImageProcessor.from_pretrained('''microsoft/dit-base-finetuned-rvlcdip'''   )
								lowerCAmelCase_      			=  AutoModelForImageClassification.from_pretrained('''microsoft/dit-base-finetuned-rvlcdip'''   )
								model.to(UpperCamelCase__   )

								from datasets import load_dataset

								lowerCAmelCase_      			=  load_dataset('''nielsr/rvlcdip-demo'''   )

								lowerCAmelCase_      			=  dataset['''train'''][0]['''image'''].convert('''RGB'''   )

								lowerCAmelCase_      			=  image_processor(UpperCamelCase__,	return_tensors='''pt'''   ).to(UpperCamelCase__   )

								# forward pass
								with torch.no_grad():
														lowerCAmelCase_      			=  model(**UpperCamelCase__   )
														lowerCAmelCase_      			=  outputs.logits

								lowerCAmelCase_      			=  torch.Size((1, 16)   )
								self.assertEqual(logits.shape,	UpperCamelCase__   )

								lowerCAmelCase_      			=  torch.tensor(
								    [-0.4_158, -0.4_092, -0.4_347],	device=UpperCamelCase__,	dtype=torch.float,	)
								self.assertTrue(torch.allclose(logits[0, :3],	UpperCamelCase__,	atol=1E-4   )   )




