

'''simple docstring'''



import contextlib
import os
import sqlitea

import pytest

from datasets import Dataset, Features, Value
from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter

from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy
def 						__lowerCamelCase       (   __snake_case     :		Any,		__snake_case     :		Optional[int]       )       ->							str:






						"""simple docstring"""





						assert isinstance(_SCREAMING_SNAKE_CASE,		_SCREAMING_SNAKE_CASE       )
						assert dataset.num_rows == 4
						assert dataset.num_columns == 3
						assert dataset.column_names == ["col_1", "col_2", "col_3"]
						for feature, expected_dtype in expected_features.items():
												assert dataset.features[feature].dtype == expected_dtype
@require_sqlalchemy
@pytest.mark.parametrize("""keep_in_memory""",		[False, True]       )
def 						__lowerCamelCase       (   __snake_case     :		List[Any],		__snake_case     :		Any,		__snake_case     :		Optional[int],		__snake_case     :		Optional[Any]       )       ->							Tuple:






						"""simple docstring"""





						A__     :   Tuple      =tmp_path / "cache"
						A__     :   Dict      ={"col_1": "string", "col_2": "int64", "col_3": "float64"}
						with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
												A__     :   Union[str, Any]      =SqlDatasetReader(
												    """dataset""",		"""sqlite:///""" + sqlite_path,		cache_dir=_SCREAMING_SNAKE_CASE,		keep_in_memory=_SCREAMING_SNAKE_CASE       ).read()
						_check_sql_dataset(_SCREAMING_SNAKE_CASE,		_SCREAMING_SNAKE_CASE       )
@require_sqlalchemy
@pytest.mark.parametrize(
    """features""",		[
        None,
        {"""col_1""": """string""", """col_2""": """int64""", """col_3""": """float64"""},
        {"""col_1""": """string""", """col_2""": """string""", """col_3""": """string"""},
        {"""col_1""": """int32""", """col_2""": """int32""", """col_3""": """int32"""},
        {"""col_1""": """float32""", """col_2""": """float32""", """col_3""": """float32"""},
    ],		)
def 						__lowerCamelCase       (   __snake_case     :		Optional[int],		__snake_case     :		Dict,		__snake_case     :		Optional[Any],		__snake_case     :		Union[str, Any]       )       ->							str:






						"""simple docstring"""





						A__     :   Tuple      =tmp_path / "cache"
						A__     :   Any      ={"col_1": "string", "col_2": "int64", "col_3": "float64"}
						A__     :   Optional[Any]      =features.copy() if features else default_expected_features
						A__     :   int      =(
						    Features({feature: Value(_SCREAMING_SNAKE_CASE       ) for feature, dtype in features.items()}       ) if features is not None else None
						)
						A__     :   Optional[int]      =SqlDatasetReader("""dataset""",		"""sqlite:///""" + sqlite_path,		features=_SCREAMING_SNAKE_CASE,		cache_dir=_SCREAMING_SNAKE_CASE       ).read()
						_check_sql_dataset(_SCREAMING_SNAKE_CASE,		_SCREAMING_SNAKE_CASE       )
def 						__lowerCamelCase       (   __snake_case     :		Dict       )       ->							Dict:






						"""simple docstring"""





						with contextlib.closing(sqlitea.connect(_SCREAMING_SNAKE_CASE       )       ) as con:
												A__     :   List[str]      =con.cursor()
												cur.execute("""SELECT * FROM dataset"""       )
												for row in cur:
																		yield row
@require_sqlalchemy
def 						__lowerCamelCase       (   __snake_case     :		Optional[Any],		__snake_case     :		Optional[Any],		__snake_case     :		List[str]       )       ->							List[str]:






						"""simple docstring"""





						A__     :   str      =tmp_path / "cache"
						A__     :   str      =os.path.join(_SCREAMING_SNAKE_CASE,		"""tmp.sql"""       )
						A__     :   Optional[int]      =SqlDatasetReader("""dataset""",		"""sqlite:///""" + sqlite_path,		cache_dir=_SCREAMING_SNAKE_CASE       ).read()
						SqlDatasetWriter(_SCREAMING_SNAKE_CASE,		"""dataset""",		"""sqlite:///""" + output_sqlite_path,		num_proc=1       ).write()

						A__     :   Optional[Any]      =iter_sql_file(_SCREAMING_SNAKE_CASE       )
						A__     :   Union[str, Any]      =iter_sql_file(_SCREAMING_SNAKE_CASE       )

						for rowa, rowa in zip(_SCREAMING_SNAKE_CASE,		_SCREAMING_SNAKE_CASE       ):
												assert rowa == rowa
@require_sqlalchemy
def 						__lowerCamelCase       (   __snake_case     :		str,		__snake_case     :		List[str],		__snake_case     :		int       )       ->							Union[str, Any]:






						"""simple docstring"""





						A__     :   Optional[Any]      =tmp_path / "cache"
						A__     :   Optional[int]      =os.path.join(_SCREAMING_SNAKE_CASE,		"""tmp.sql"""       )
						A__     :   List[str]      =SqlDatasetReader("""dataset""",		"""sqlite:///""" + sqlite_path,		cache_dir=_SCREAMING_SNAKE_CASE       ).read()
						SqlDatasetWriter(_SCREAMING_SNAKE_CASE,		"""dataset""",		"""sqlite:///""" + output_sqlite_path,		num_proc=2       ).write()

						A__     :   List[str]      =iter_sql_file(_SCREAMING_SNAKE_CASE       )
						A__     :   Any      =iter_sql_file(_SCREAMING_SNAKE_CASE       )

						for rowa, rowa in zip(_SCREAMING_SNAKE_CASE,		_SCREAMING_SNAKE_CASE       ):
												assert rowa == rowa
@require_sqlalchemy
def 						__lowerCamelCase       (   __snake_case     :		Dict,		__snake_case     :		List[str],		__snake_case     :		int       )       ->							List[Any]:






						"""simple docstring"""





						A__     :   List[Any]      =tmp_path / "cache"
						A__     :   List[str]      =os.path.join(_SCREAMING_SNAKE_CASE,		"""tmp.sql"""       )
						A__     :   Optional[int]      =SqlDatasetReader("""dataset""",		"""sqlite:///""" + sqlite_path,		cache_dir=_SCREAMING_SNAKE_CASE       ).read()
						with pytest.raises(_SCREAMING_SNAKE_CASE       ):
												SqlDatasetWriter(_SCREAMING_SNAKE_CASE,		"""dataset""",		"""sqlite:///""" + output_sqlite_path,		num_proc=0       ).write()







def      A      (      _SCREAMING_SNAKE_CASE = 100_0000    )	-> int:
       lowerCamelCase   :      Tuple			 =					1
       lowerCamelCase   :      int			 =					1
       lowerCamelCase   :      Optional[Any]			 =					{1: 1}

       for inputa in range(2 ,_SCREAMING_SNAKE_CASE    ):
              lowerCamelCase   :      Union[str, Any]			 =					0
              lowerCamelCase   :      List[str]			 =					inputa

              while True:
                     if number in counters:
                            counter += counters[number]
                            break
                     if number % 2 == 0:
                            number //= 2
                            counter += 1
                     else:
                            lowerCamelCase   :      str			 =					(3 * number) + 1
                            counter += 1

              if inputa not in counters:
                     lowerCamelCase   :      str			 =					counter

              if counter > pre_counter:
                     lowerCamelCase   :      str			 =					inputa
                     lowerCamelCase   :      Any			 =					counter
       return largest_number


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






