

from __future__ import annotations

a_         =      {1: 1}

def 	lowerCamelCase__	(   _a):
 if n in COLLATZ_SEQUENCE_LENGTHS:
  return COLLATZ_SEQUENCE_LENGTHS[n]
 SCREAMING_SNAKE_CASE				: Tuple			       =    n // 2 if n % 2 == 0 else 3 * n + 1
 SCREAMING_SNAKE_CASE				: Tuple			       =    collatz_sequence_length(_a) + 1
 SCREAMING_SNAKE_CASE				: List[Any]			       =    sequence_length
 return sequence_length

def 	lowerCamelCase__	(   _a = 1000000):
 SCREAMING_SNAKE_CASE				: int			       =    max((collatz_sequence_length(_a), i) for i in range(1							,     _a))
 return result[1]


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


from __future__ import annotations

def 	lowerCamelCase__	(   _a							,     _a							,     _a):
	if len(_a) == 0:
		raise ValueError("find_min() arg is an empty sequence")
	if (
	    left >= len(_a)
	    or left < -len(_a)
	    or right >= len(_a)
	    or right < -len(_a)
	):
		raise IndexError("list index out of range")
	if left == right:
		return nums[left]
	SCREAMING_SNAKE_CASE				: List[str]			       =    (left + right) >> 1  # the middle
	SCREAMING_SNAKE_CASE				: Tuple			       =    find_min(_a							,     _a							,     _a)  # find min in range[left, mid]
	SCREAMING_SNAKE_CASE				: Optional[Any]			       =    find_min(_a							,     mid + 1							,     _a)  # find min in range[mid + 1, right]

	return left_min if left_min <= right_min else right_min


if __name__ == "__main__":
			import doctest

			doctest.testmod(verbose=True)