



import math

class        _A			:



       def __init__(						self				:	str	,						__SCREAMING_SNAKE_CASE				:	Dict):


           '''simple docstring'''

           __a					=							len(__SCREAMING_SNAKE_CASE)
           __a					=							[0] * (
               4 * self.N
           )  # approximate the overall size of segment tree with array N
           self.build(1	,						0	,						self.N - 1)



       def 						_lowerCamelCase     (						self				:	Union[str, Any]	,						__SCREAMING_SNAKE_CASE				:	Optional[Any]):


           '''simple docstring'''

           return idx * 2



       def 						_lowerCamelCase     (						self				:	Optional[Any]	,						__SCREAMING_SNAKE_CASE				:	str):


           '''simple docstring'''

           return idx * 2 + 1



       def 						_lowerCamelCase     (						self				:	Optional[Any]	,						__SCREAMING_SNAKE_CASE				:	Optional[Any]	,						__SCREAMING_SNAKE_CASE				:	Optional[int]	,						__SCREAMING_SNAKE_CASE				:	Any):  # noqa: E741


           '''simple docstring'''

           if l == r:
               __a					=							A[l]
           else:
               __a					=							(l + r) // 2
               self.build(self.left(__SCREAMING_SNAKE_CASE)	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)
               self.build(self.right(__SCREAMING_SNAKE_CASE)	,						mid + 1	,						__SCREAMING_SNAKE_CASE)
               __a					=							max(self.st[self.left(__SCREAMING_SNAKE_CASE)]	,						self.st[self.right(__SCREAMING_SNAKE_CASE)])



       def 						_lowerCamelCase     (						self				:	Any	,						__SCREAMING_SNAKE_CASE				:	Dict	,						__SCREAMING_SNAKE_CASE				:	Union[str, Any]	,						__SCREAMING_SNAKE_CASE				:	List[str]):


           '''simple docstring'''

           return self.update_recursive(1	,						0	,						self.N - 1	,						a - 1	,						b - 1	,						__SCREAMING_SNAKE_CASE)



       def 						_lowerCamelCase     (						self				:	Any	,						__SCREAMING_SNAKE_CASE				:	Union[str, Any]	,						__SCREAMING_SNAKE_CASE				:	Dict	,						__SCREAMING_SNAKE_CASE				:	Dict	,						__SCREAMING_SNAKE_CASE				:	List[Any]	,						__SCREAMING_SNAKE_CASE				:	Optional[int]	,						__SCREAMING_SNAKE_CASE				:	Union[str, Any]):  # noqa: E741


           '''simple docstring'''

           if r < a or l > b:
               return True
           if l == r:
               __a					=							val
               return True
           __a					=							(l + r) // 2
           self.update_recursive(self.left(__SCREAMING_SNAKE_CASE)	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)
           self.update_recursive(self.right(__SCREAMING_SNAKE_CASE)	,						mid + 1	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)
           __a					=							max(self.st[self.left(__SCREAMING_SNAKE_CASE)]	,						self.st[self.right(__SCREAMING_SNAKE_CASE)])
           return True



       def 						_lowerCamelCase     (						self				:	int	,						__SCREAMING_SNAKE_CASE				:	Optional[Any]	,						__SCREAMING_SNAKE_CASE				:	Union[str, Any]):


           '''simple docstring'''

           return self.query_recursive(1	,						0	,						self.N - 1	,						a - 1	,						b - 1)



       def 						_lowerCamelCase     (						self				:	List[Any]	,						__SCREAMING_SNAKE_CASE				:	Any	,						__SCREAMING_SNAKE_CASE				:	Tuple	,						__SCREAMING_SNAKE_CASE				:	int	,						__SCREAMING_SNAKE_CASE				:	str	,						__SCREAMING_SNAKE_CASE				:	Union[str, Any]):  # noqa: E741


           '''simple docstring'''

           if r < a or l > b:
               return -math.inf
           if l >= a and r <= b:
               return self.st[idx]
           __a					=							(l + r) // 2
           __a					=							self.query_recursive(self.left(__SCREAMING_SNAKE_CASE)	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)
           __a					=							self.query_recursive(self.right(__SCREAMING_SNAKE_CASE)	,						mid + 1	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)
           return max(__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)





       def 						_lowerCamelCase     (						self				:	Union[str, Any]):


           '''simple docstring'''

           __a					=							[]
           for i in range(1	,						N + 1):
               show_list += [self.query(__SCREAMING_SNAKE_CASE	,						__SCREAMING_SNAKE_CASE)]
           print(__SCREAMING_SNAKE_CASE)


if __name__ == "__main__":
 __snake_case		:int 						=	[1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
 __snake_case		:Any 						=	15
 __snake_case		:Any 						=	SegmentTree(A)
 print(segt.query(4, 6))
 print(segt.query(7, 11))
 print(segt.query(7, 12))
 segt.update(1, 3, 111)
 print(segt.query(1, 15))
 segt.update(7, 8, 235)
 segt.show_data()










from __future__ import annotations

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





def 	__snake_case      (     _UpperCAmelCase							):
    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 = 1000000							):
    __a					=							max((collatz_sequence_length(_UpperCAmelCase							), i) for i in range(1  ,					_UpperCAmelCase							)							)
    return result[1]


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





