


import argparse
import logging
import pickle
from collections import Counter


logging.basicConfig(
    format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO
)
_UpperCAmelCase			:  List[Any]     =logging.getLogger(__name__)

if __name__ == "__main__":
						_UpperCAmelCase			:  Dict     =argparse.ArgumentParser(
						    description="""Token Counts for smoothing the masking probabilities in MLM (cf XLM/word2vec)"""
						)
						parser.add_argument(
						    """--data_file""", type=str, default="""data/dump.bert-base-uncased.pickle""", help="""The binarized dataset."""
						)
						parser.add_argument(
						    """--token_counts_dump""", type=str, default="""data/token_counts.bert-base-uncased.pickle""", help="""The dump file."""
						)
						parser.add_argument("""--vocab_size""", default=3_0522, type=int)
						_UpperCAmelCase			:  str     =parser.parse_args()

						logger.info(f"""Loading data from {args.data_file}""")
						with open(args.data_file, """rb""") as fp:
												_UpperCAmelCase			:  str     =pickle.load(fp)

						logger.info("""Counting occurrences for MLM.""")
						_UpperCAmelCase			:  List[Any]     =Counter()
						for tk_ids in data:
												counter.update(tk_ids)
						_UpperCAmelCase			:  Tuple     =[0] * args.vocab_size
						for k, v in counter.items():
												_UpperCAmelCase			:  Union[str, Any]     =v

						logger.info(f"""Dump to {args.token_counts_dump}""")
						with open(args.token_counts_dump, """wb""") as handle:
												pickle.dump(counts, handle, protocol=pickle.HIGHEST_PROTOCOL)



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