




'''simple docstring'''







def 		_lowercase		(	lowercase_						,							lowercase_						,							lowercase_  ):



		'''simple docstring'''







		if power < 0:
				return -1
		base %= mod
		_snake_case	       =       1

		while power > 0:
				if power & 1:
						_snake_case	       =       (result * base) % mod
				_snake_case	       =       power >> 1
				_snake_case	       =       (base * base) % mod

		return result






def 		_lowercase		(	):



		'''simple docstring'''







		print(modular_exponential(3						,							200						,							13  )  )


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						main()











'''simple docstring'''







from __future__ import annotations

_lowerCamelCase							:						Union[str, Any]								=  {1: 1}






def 		_lowercase		(	lowercase_  ):



		'''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(lowercase_  ) + 1
		_snake_case	       =       sequence_length
		return sequence_length






def 		_lowercase		(	lowercase_ = 1000000  ):



		'''simple docstring'''







		_snake_case	       =       max((collatz_sequence_length(lowercase_  ), i) for i in range(1						,							lowercase_  )  )
		return result[1]


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





