object Main extends App {
    val N = readInt
    def calc(c:Int, i:Int, j:Int):Array[Int] =  {
        if(c + 1 > N / c) {
            Array(i,j)
        } else {
            var ji = j
          	var ii = i
            if(N%c==0) {
                ji = N / c
                ii = c
            }
            calc(c+1, ii , ji)
        }
    }
    var ans = calc(1, 1 ,1)
    println(ans(0) + ans(1))        

}