module Main where

import Control.Applicative
import Control.Monad
import Data.List

f :: Int -> Int
f 0 = 0
f n = iter 0 n
  where
    iter k x = case x `divMod` 2 of
        (q, 0) -> iter (k + 1) q
        (q, r) -> k

main :: IO ()
main = do
    n <- readLn :: IO Int
    let ans = head $ sortBy (\a b -> f b `compare` f a) [1 .. n]
    print ans