open System

let n = stdin.ReadLine() |> int64

let sq = float n |> Math.Sqrt |> int64

let rec f x = if n % x = 0L then (x , n / x) else f (x - 1L)

let g (x,y) = x + y - 2L

f sq
|>g
|>stdout.WriteLine