import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine

getRoot :: Int -> Int -> (Int, Int)
getRoot n r
  | n `mod` r == 0 = (r, n `div` r)
  | otherwise = getRoot n (r + 1)

main = do
  n <- getInt
  let r = round (sqrt (fromIntegral n :: Float))
  let t = getRoot n r
  print $ fst t + snd t - 2
