





from __future__ import annotations

a__   :       Optional[Any]   						=			{1: 1}





def 							a__     (					_UpperCAmelCase		)      ->					int:

 '''simple docstring'''






 if n in COLLATZ_SEQUENCE_LENGTHS:
  return COLLATZ_SEQUENCE_LENGTHS[n]
 snake_case__      							=			n // 2 if n % 2 == 0 else 3 * n + 1
 snake_case__      							=			collatz_sequence_length(__UpperCamelCase		) + 1
 snake_case__      							=			sequence_length
 return sequence_length





def 							a__     (					_UpperCAmelCase = 1_0_0_0_0_0_0		)      ->					Dict:

 '''simple docstring'''






 snake_case__      							=			max((collatz_sequence_length(__UpperCamelCase		), i) for i in range(1		,       __UpperCamelCase		)		)
 return result[1]


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








"""simple docstring"""


import math





def 							a__     (					_UpperCAmelCase		)      ->					list:

 '''simple docstring'''






 if n <= 0:
  raise ValueError("Only positive integers have prime factors"		)
 snake_case__      							=			[]
 while n % 2 == 0:
  pf.append(2		)
  snake_case__      							=			int(n / 2		)
 for i in range(3		,       int(math.sqrt(_UpperCAmelCase		)		) + 1		,       2		):
  while n % i == 0:
   pf.append(_UpperCAmelCase		)
   snake_case__      							=			int(n / i		)
 if n > 2:
  pf.append(_UpperCAmelCase		)
 return pf





def 							a__     (					_UpperCAmelCase		)      ->					int:

 '''simple docstring'''






 if n <= 0:
  raise ValueError("Only positive numbers are accepted"		)
 snake_case__      							=			1
 snake_case__      							=			1
 while n % 2 == 0:
  temp += 1
  snake_case__      							=			int(n / 2		)
 div *= temp
 for i in range(3		,       int(math.sqrt(_UpperCAmelCase		)		) + 1		,       2		):
  snake_case__      							=			1
  while n % i == 0:
   temp += 1
   snake_case__      							=			int(n / i		)
  div *= temp
 if n > 1:
  div *= 2
 return div





def 							a__     (					_UpperCAmelCase		)      ->					int:

 '''simple docstring'''






 if n <= 0:
  raise ValueError("Only positive numbers are accepted"		)
 snake_case__      							=			1
 snake_case__      							=			1
 while n % 2 == 0:
  temp += 1
  snake_case__      							=			int(n / 2		)
 if temp > 1:
  s *= (2**temp - 1) / (2 - 1)
 for i in range(3		,       int(math.sqrt(_UpperCAmelCase		)		) + 1		,       2		):
  snake_case__      							=			1
  while n % i == 0:
   temp += 1
   snake_case__      							=			int(n / i		)
  if temp > 1:
   s *= (i**temp - 1) / (i - 1)
 return int(_UpperCAmelCase		)





def 							a__     (					_UpperCAmelCase		)      ->					int:

 '''simple docstring'''






 snake_case__      							=			n
 for x in set(prime_factors(_UpperCAmelCase		)		):
  s *= (x - 1) / x
 return int(_UpperCAmelCase		)


if __name__ == "__main__":
   import doctest

   doctest.testmod()

