import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    k = sq n
    (q, r) = until ((== 0) . snd . (divMod n)) pred k
  print $ pred q + pred r

sq :: Int -> Int
-- sq n = sq' 1 . succ $ n
--   where
--     sq' i j | j == succ i = i
--             | m ^ 2 <= n = sq' m j
--             | otherwise = sq' i m
--       where
--         m = (i + j) `div` 2
sq = floor . sqrt . fromIntegral

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
