
"""simple docstring"""




from __future__ import annotations

__lowerCAmelCase							:  List[str] 				=		{1: 1}

def __snake_case (      UpperCamelCase    )       ->    int:


		"""simple docstring"""





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

def __snake_case (      UpperCamelCase = 1_000_000    )       ->    int:


		"""simple docstring"""





		a__   		=     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"""




def __snake_case (      UpperCamelCase = 10**6    )       ->    int:


		"""simple docstring"""





		if n <= 0:
				raise ValueError('''Please enter an integer greater than 0'''    )

		a__   		=     list(range(n + 1    )    )
		for number in range(2						,					n + 1    ):
				if phi[number] == number:
						phi[number] -= 1
						for multiple in range(number * 2						,					n + 1						,					UpperCamelCase    ):
								a__   		=     (phi[multiple] // number) * (number - 1)

		a__   		=     1
		for number in range(1						,					n + 1    ):
				if (answer / phi[answer]) < (number / phi[number]):
						a__   		=     number

		return answer


if __name__ == "__main__":
					print(solution())




