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

f :: Int -> [Int]
f x = unfoldr g (0, x)
  where
    g (i, 0) = Nothing
    g (i, r)
        | i + 1 == r  = Just (i + 1, (i + 1, 0))
        | i + 2 <= r' = Just (i + 1, (i + 1, r'))
        | otherwise   = Just (0,     (i + 1, r))
      where
        r' = r - (i + 1)

main :: IO ()
main = do
    x <- readLn :: IO Int
    print $ length (f x)