main :: IO ()
main = do
  n <- readLn
  print $ solve n

solve :: Int -> Int
solve n = minimum [ a + b - 2 | a <- [1 .. sqrt_n], b <- [a .. n] , a * b == n ]
  where sqrt_n = floor $ sqrt $ fromIntegral n