


'''simple docstring'''







import math

import flax.linen as nn
import jax.numpy as jnp




def        __lowercase						(      __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE = 1				,  __SCREAMING_SNAKE_CASE = 1				,  __SCREAMING_SNAKE_CASE = 1.0E4				,  __SCREAMING_SNAKE_CASE = False				,  __SCREAMING_SNAKE_CASE = 1.0				,  )				->					jnp.ndarray:
     """simple docstring"""




     assert timesteps.ndim == 1, "Timesteps should be a 1d-array"
     assert embedding_dim % 2 == 0, F'''Embedding dimension {embedding_dim} should be even'''
     __a       =   float(embedding_dim // 2		)
     __a       =   math.log(max_timescale / min_timescale		) / (num_timescales - freq_shift)
     __a       =   min_timescale * jnp.exp(jnp.arange(__SCREAMING_SNAKE_CASE				,  dtype=jnp.floataa		) * -log_timescale_increment		)
     __a       =   jnp.expand_dims(__SCREAMING_SNAKE_CASE				,  1		) * jnp.expand_dims(__SCREAMING_SNAKE_CASE				,  0		)

     # scale embeddings
     __a       =   scale * emb

     if flip_sin_to_cos:
          __a       =   jnp.concatenate([jnp.cos(__SCREAMING_SNAKE_CASE		), jnp.sin(__SCREAMING_SNAKE_CASE		)]				,  axis=1		)
     else:
          __a       =   jnp.concatenate([jnp.sin(__SCREAMING_SNAKE_CASE		), jnp.cos(__SCREAMING_SNAKE_CASE		)]				,  axis=1		)
     __a       =   jnp.reshape(__SCREAMING_SNAKE_CASE				,  [jnp.shape(__SCREAMING_SNAKE_CASE		)[0], embedding_dim]		)
     return signal


class  lowerCAmelCase_						(       nn.Module      ):





  """simple docstring"""



  a_       :int												=32
  a_       :jnp.dtype												=jnp.floataa

  @nn.compact
  def __call__(					self     :							Any				,							SCREAMING_SNAKE_CASE__     :							Tuple						):





       '''simple docstring'''

       __a       =   nn.Dense(self.time_embed_dim				,							dtype=self.dtype				,							name="""linear_1"""						)(SCREAMING_SNAKE_CASE__						)
       __a       =   nn.silu(SCREAMING_SNAKE_CASE__						)
       __a       =   nn.Dense(self.time_embed_dim				,							dtype=self.dtype				,							name="""linear_2"""						)(SCREAMING_SNAKE_CASE__						)
       return temb


class  lowerCAmelCase_						(       nn.Module      ):





  """simple docstring"""



  a_       :int												=32
  a_       :bool												=False
  a_       :float												=1

  @nn.compact
  def __call__(					self     :							str				,							SCREAMING_SNAKE_CASE__     :							Any						):





       '''simple docstring'''

       return get_sinusoidal_embeddings(
           SCREAMING_SNAKE_CASE__				,							embedding_dim=self.dim				,							flip_sin_to_cos=self.flip_sin_to_cos				,							freq_shift=self.freq_shift						)










'''simple docstring'''







def        __lowercase						(      __SCREAMING_SNAKE_CASE = 100_0000		)				->					int:
     """simple docstring"""




     __a       =   1
     __a       =   1
     __a       =   {1: 1}

     for inputa in range(2				,  __SCREAMING_SNAKE_CASE		):
          __a       =   0
          __a       =   inputa

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

          if inputa not in counters:
               __a       =   counter

          if counter > pre_counter:
               __a       =   inputa
               __a       =   counter
     return largest_number


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






