a = gets.chomp.to_i

MAX = 10**12
def solve(a)
    ms = 1..MAX

    # find the first n to start
    n = -1
    ms.each {|m|
        if a < m*m
            n = m
            break
        end
    }

    # iterate from (n,1)~(n,n)
    while (n <= MAX)
        (1..n).each {|i|
            if a == i*n
                return (n-1) + (i-1)
            end
        }
        n += 1
    end
end

puts solve(a)