from __future__ import annotations

__lowerCamelCase     :					str				  =						{1: 1}



def       __SCREAMING_SNAKE_CASE    (   __UpperCamelCase       :			int      )				->   int:







  """simple docstring"""





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



def       __SCREAMING_SNAKE_CASE    (   __UpperCamelCase       :			int = 1_00_00_00      )				->   int:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__     				= max((collatz_sequence_length(__UpperCamelCase      ), i) for i in range(1					,	__UpperCamelCase      )      )
  return result[1]


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

from hashlib import mda, shaaaa

__lowerCamelCase     :					Dict				  =						(shaaaa, mda)







class __snake_case							:




   def __init__(       self     :							str			,      _lowercase     :							int = 8 ):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__     				= 0B0
     SCREAMING_SNAKE_CASE__     				= size




   def       __a		(       self     :							List[str]			,      _lowercase     :							str ):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__     				= self.hash_(_lowercase )
     self.bitarray |= h




   def       __a		(       self     :							int			,      _lowercase     :							str ):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__     				= self.hash_(_lowercase )
     return (h & self.bitarray) == h




   def __contains__(       self     :							Union[str, Any]			,      _lowercase     :							str ):



     """simple docstring"""






     return self.exists(_lowercase )




   def       __a		(       self     :							Dict			,      _lowercase     :							int ):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__     				= bin(_lowercase )[2:]
     return res.zfill(self.size )




   @property
   def       __a		(       self     :							Tuple ):



     """simple docstring"""






     return self.format_bin(self.bitarray )




   def       __a		(       self     :							Optional[int]			,      _lowercase     :							str ):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__     				= 0B0
     for func in HASH_FUNCTIONS:
       SCREAMING_SNAKE_CASE__     				= (
           int.from_bytes(func(value.encode() ).digest()			,      """little""" ) % self.size
       )
       res |= 2**position
     return res




   def       __a		(       self     :							str			,      _lowercase     :							str ):



     """simple docstring"""






     return self.format_bin(self.hash_(_lowercase ) )




   @property
   def       __a		(       self     :							Union[str, Any] ):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__     				= bin(self.bitarray ).count("""1""" )
     return (n_ones / self.size) ** len(_lowercase )
