





"""simple docstring"""




def        a_				(							_lowercase       ,						_lowercase = 1000   ):
						if (not isinstance(_lowercase       ,						_lowercase   )) or (digit_position <= 0):
												raise ValueError('''Digit position must be a positive integer'''   )
						elif (not isinstance(_lowercase       ,						_lowercase   )) or (precision < 0):
												raise ValueError('''Precision must be a nonnegative integer'''   )

						# compute an approximation of (16 ** (n - 1)) * pi whose fractional part is mostly
						# accurate
						_UpperCamelCase			:					List[str]     =    (
						    4 * _subsum(_lowercase       ,						1       ,						_lowercase   )
						    - 2 * _subsum(_lowercase       ,						4       ,						_lowercase   )
						    - _subsum(_lowercase       ,						5       ,						_lowercase   )
						    - _subsum(_lowercase       ,						6       ,						_lowercase   )
						)

						# return the first hex digit of the fractional part of the result
						return hex(int((sum_result % 1) * 16   )   )[2:]





def        a_				(							_lowercase       ,						_lowercase       ,						_lowercase   ):
						_UpperCamelCase			:					int     =    0.0
						for sum_index in range(digit_pos_to_extract + precision   ):
												_UpperCamelCase			:					str     =    8 * sum_index + denominator_addend
												if sum_index < digit_pos_to_extract:
																		# if the exponential term is an integer and we mod it by the denominator
																		# before dividing, only the integer part of the sum will change;
																		# the fractional part will not
																		_UpperCamelCase			:					Optional[int]     =    pow(
																		    16       ,						digit_pos_to_extract - 1 - sum_index       ,						_lowercase   )
												else:
																		_UpperCamelCase			:					Tuple     =    pow(16       ,						digit_pos_to_extract - 1 - sum_index   )
												total += exponential_term / denominator
						return total


if __name__ == "__main__":
						import doctest

						doctest.testmod()









'''simple docstring'''
from __future__ import annotations

A							:      List[str] 	=       {1: 1}
def 				snake_case_  (   a__		:	int			):



    """simple docstring"""




    if n in COLLATZ_SEQUENCE_LENGTHS:
        return COLLATZ_SEQUENCE_LENGTHS[n]
    __lowercase							=						n // 2 if n % 2 == 0 else 3 * n + 1
    __lowercase							=						collatz_sequence_length(a__			) + 1
    __lowercase							=						sequence_length
    return sequence_length
def 				snake_case_  (   a__		:	int = 1_00_00_00			):



    """simple docstring"""




    __lowercase							=						max((collatz_sequence_length(a__			), i) for i in range(1    ,a__			)			)
    return result[1]


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




