


from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
						from transformers import (
						    AutoConfig,
						    BertConfig,
						    GPTaConfig,
						    TaConfig,
						    TFAutoModel,
						    TFAutoModelForCausalLM,
						    TFAutoModelForMaskedLM,
						    TFAutoModelForPreTraining,
						    TFAutoModelForQuestionAnswering,
						    TFAutoModelForSeqaSeqLM,
						    TFAutoModelForSequenceClassification,
						    TFAutoModelWithLMHead,
						    TFBertForMaskedLM,
						    TFBertForPreTraining,
						    TFBertForQuestionAnswering,
						    TFBertForSequenceClassification,
						    TFBertModel,
						    TFGPTaLMHeadModel,
						    TFRobertaForMaskedLM,
						    TFTaForConditionalGeneration,
						)
						from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
						from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
						from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST

if is_torch_available():
						from transformers import (
						    AutoModel,
						    AutoModelForCausalLM,
						    AutoModelForMaskedLM,
						    AutoModelForPreTraining,
						    AutoModelForQuestionAnswering,
						    AutoModelForSeqaSeqLM,
						    AutoModelForSequenceClassification,
						    AutoModelWithLMHead,
						    BertForMaskedLM,
						    BertForPreTraining,
						    BertForQuestionAnswering,
						    BertForSequenceClassification,
						    BertModel,
						    GPTaLMHeadModel,
						    RobertaForMaskedLM,
						    TaForConditionalGeneration,
						)







@is_pt_tf_cross_test
class 				snake_case__(							unittest.TestCase							):







						'''simple docstring'''




						@slow
						def 						lowercase_ (				self							)					->    Tuple:
										# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										for model_name in ["bert-base-uncased"]:
														lowerCAmelCase_ :      Optional[int]    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Dict    				=				TFAutoModel.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Tuple    				=				AutoModel.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    List[str]:
										# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										for model_name in ["bert-base-uncased"]:
														lowerCAmelCase_ :      Dict    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      List[str]    				=				TFAutoModelForPreTraining.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Tuple    				=				AutoModelForPreTraining.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    Dict:
										for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														lowerCAmelCase_ :      List[str]    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      List[Any]    				=				TFAutoModelForCausalLM.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_ :      List[str]    				=				TFAutoModelForCausalLM.from_pretrained(
														    __lowercase   ,						output_loading_info=__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      str    				=				AutoModelForCausalLM.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_ :      List[Any]    				=				AutoModelForCausalLM.from_pretrained(
														    __lowercase   ,						output_loading_info=__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    Optional[int]:
										for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														lowerCAmelCase_ :      List[Any]    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      str    				=				TFAutoModelWithLMHead.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Dict    				=				AutoModelWithLMHead.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    Any:
										for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														lowerCAmelCase_ :      str    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      int    				=				TFAutoModelForMaskedLM.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_ :      Dict    				=				TFAutoModelForMaskedLM.from_pretrained(
														    __lowercase   ,						output_loading_info=__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Tuple    				=				AutoModelForMaskedLM.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_ :      Optional[int]    				=				AutoModelForMaskedLM.from_pretrained(
														    __lowercase   ,						output_loading_info=__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    List[str]:
										for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														lowerCAmelCase_ :      Union[str, Any]    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Union[str, Any]    				=				TFAutoModelForSeqaSeqLM.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_ :      List[str]    				=				TFAutoModelForSeqaSeqLM.from_pretrained(
														    __lowercase   ,						output_loading_info=__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Optional[Any]    				=				AutoModelForSeqaSeqLM.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														lowerCAmelCase_				,  lowerCAmelCase_ :      Optional[Any]    				=				AutoModelForSeqaSeqLM.from_pretrained(
														    __lowercase   ,						output_loading_info=__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    int:
										# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										for model_name in ["bert-base-uncased"]:
														lowerCAmelCase_ :      Tuple    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Optional[Any]    				=				TFAutoModelForSequenceClassification.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Dict    				=				AutoModelForSequenceClassification.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						@slow
						def 						lowercase_ (				self							)					->    str:
										# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										for model_name in ["bert-base-uncased"]:
														lowerCAmelCase_ :      int    				=				AutoConfig.from_pretrained(__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      int    				=				TFAutoModelForQuestionAnswering.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)

														lowerCAmelCase_ :      Any    				=				AutoModelForQuestionAnswering.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
														self.assertIsNotNone(__lowercase							)
														self.assertIsInstance(__lowercase   ,						__lowercase							)




						def 						lowercase_ (				self							)					->    Tuple:
										lowerCAmelCase_ :      Union[str, Any]    				=				TFAutoModelWithLMHead.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
										self.assertIsInstance(__lowercase   ,						__lowercase							)
										self.assertEqual(model.num_parameters()   ,						1_4_4_1_0							)
										self.assertEqual(model.num_parameters(only_trainable=__lowercase							)   ,						1_4_4_1_0							)

										lowerCAmelCase_ :      Dict    				=				AutoModelWithLMHead.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
										self.assertIsInstance(__lowercase   ,						__lowercase							)
										self.assertEqual(model.num_parameters()   ,						1_4_4_1_0							)
										self.assertEqual(model.num_parameters(only_trainable=__lowercase							)   ,						1_4_4_1_0							)




						def 						lowercase_ (				self							)					->    List[str]:
										lowerCAmelCase_ :      str    				=				TFAutoModelWithLMHead.from_pretrained(__lowercase   ,						from_pt=__lowercase							)
										self.assertIsInstance(__lowercase   ,						__lowercase							)
										self.assertEqual(model.num_parameters()   ,						1_4_4_1_0							)
										self.assertEqual(model.num_parameters(only_trainable=__lowercase							)   ,						1_4_4_1_0							)

										lowerCAmelCase_ :      List[str]    				=				AutoModelWithLMHead.from_pretrained(__lowercase   ,						from_tf=__lowercase							)
										self.assertIsInstance(__lowercase   ,						__lowercase							)
										self.assertEqual(model.num_parameters()   ,						1_4_4_1_0							)
										self.assertEqual(model.num_parameters(only_trainable=__lowercase							)   ,						1_4_4_1_0							)



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())))