




'''simple docstring'''


import math

class 			A    :







							def __init__(  self       :  List[str]							,			lowerCAmelCase_       :  Any							,			lowerCAmelCase_       :  Optional[Any]							,			lowerCAmelCase_       :  Any							,			lowerCAmelCase_       :  Tuple					)			->							str:


														"""simple docstring"""


														_a	     =				x
														_a	     =				y
														_a	     =				step_size
														_a	     =				function_to_optimize







							def    __lowerCAmelCase			(  self       :  int					)			->							List[str]:


														"""simple docstring"""


														return self.function(self.x							,			self.y					)







							def    __lowerCAmelCase			(  self       :  Dict					)			->							Any:


														"""simple docstring"""


														_a	     =				self.step_size
														return [
														    SearchProblem(__UpperCamelCase							,			__UpperCamelCase							,			__UpperCamelCase							,			self.function					)
														    for x, y in (
														        (self.x - step_size, self.y - step_size),
														        (self.x - step_size, self.y),
														        (self.x - step_size, self.y + step_size),
														        (self.x, self.y - step_size),
														        (self.x, self.y + step_size),
														        (self.x + step_size, self.y - step_size),
														        (self.x + step_size, self.y),
														        (self.x + step_size, self.y + step_size),
														    )
														]







							def __hash__(  self       :  List[str]					)			->							List[Any]:


														"""simple docstring"""


														return hash(str(self					)					)







							def __eq__(  self       :  Tuple							,			lowerCAmelCase_       :  Dict					)			->							str:


														"""simple docstring"""


														if isinstance(__UpperCamelCase							,			__UpperCamelCase					):
																					return hash(str(self					)					) == hash(str(__UpperCamelCase					)					)
														return False







							def __str__(  self       :  List[str]					)			->							Optional[Any]:


														"""simple docstring"""


														return F'x: {self.x} y: {self.y}'



def 		snake_case_    (UpperCamelCase       :  Union[str, Any] ,						UpperCamelCase       :  Optional[Any] = True ,						UpperCamelCase       :  List[Any] = math.inf ,						UpperCamelCase       :  str = -math.inf ,						UpperCamelCase       :  List[Any] = math.inf ,						UpperCamelCase       :  Dict = -math.inf ,						UpperCamelCase       :  Union[str, Any] = False ,						UpperCamelCase       :  List[Any] = 1_0000 ,						):





							'''simple docstring'''


							_a	     =				search_prob
							_a	     =				[]  # list to store the current score at each iteration
							_a	     =				0
							_a	     =				False
							_a	     =				set()
							while not solution_found and iterations < max_iter:
														visited.add(lowercase_      )
														iterations += 1
														_a	     =				current_state.score()
														scores.append(lowercase_      )
														_a	     =				current_state.get_neighbors()
														_a	     =				-math.inf
														_a	     =				math.inf
														_a	     =				None  # to hold the next best neighbor
														for neighbor in neighbors:
																					if neighbor in visited:
																												continue  # do not want to visit the same state again
																					if (
																					    neighbor.x > max_x
																					    or neighbor.x < min_x
																					    or neighbor.y > max_y
																					    or neighbor.y < min_y
																					):
																												continue  # neighbor outside our bounds
																					_a	     =				neighbor.score() - current_score
																					if find_max:  # finding max
																												# going to direction with greatest ascent
																												if change > max_change and change > 0:
																																			_a	     =				change
																																			_a	     =				neighbor
																					else:  # finding min
																												# to direction with greatest descent
																												if change < min_change and change < 0:
																																			_a	     =				change
																																			_a	     =				neighbor
														if next_state is not None:
																					# we found at least one neighbor which improved the current state
																					_a	     =				next_state
														else:
																					# since we have no neighbor that improves the solution we stop the search
																					_a	     =				True

							if visualization:
														from matplotlib import pyplot as plt

														plt.plot(range(lowercase_      ) ,						lowercase_      )
														plt.xlabel('''Iterations'''      )
														plt.ylabel('''Function values'''      )
														plt.show()

							return current_state


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				def 		snake_case_    (UpperCamelCase       :  str ,						UpperCamelCase       :  Any      ):





											'''simple docstring'''


											return (x**2) + (y**2)

				# starting the problem with initial coordinates (3, 4)
				_snake_case      :      List[str]   							=		SearchProblem(x=3, y=4, step_size=1, function_to_optimize=test_fa)
				_snake_case      :      Dict   							=		hill_climbing(prob, find_max=False)
				print(
				    'The minimum score for f(x, y) = x^2 + y^2 found via hill climbing: '
				    F'''{local_min.score()}'''
				)

				# starting the problem with initial coordinates (12, 47)
				_snake_case      :      List[Any]   							=		SearchProblem(x=12, y=47, step_size=1, function_to_optimize=test_fa)
				_snake_case      :      Union[str, Any]   							=		hill_climbing(
				    prob, find_max=False, max_x=100, min_x=5, max_y=50, min_y=-5, visualization=True
				)
				print(
				    'The minimum score for f(x, y) = x^2 + y^2 with the domain 100 > x > 5 '
				    F'''and 50 > y > - 5 found via hill climbing: {local_min.score()}'''
				)
				def 		snake_case_    (UpperCamelCase       :  Union[str, Any] ,						UpperCamelCase       :  Dict      ):





											'''simple docstring'''


											return (3 * x**2) - (6 * y)

				_snake_case      :      int   							=		SearchProblem(x=3, y=4, step_size=1, function_to_optimize=test_fa)
				_snake_case      :      Tuple   							=		hill_climbing(prob, find_max=True)

				print(
				    'The maximum score for f(x, y) = x^2 + y^2 found via hill climbing: '
				    F'''{local_min.score()}'''
				)







'''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())))





