function Main (input){
  input = input.split("\n");
  tmp = input[0].split(" ");
  var N = parseInt(tmp[0],10);
  var i = 1;
  var j = 1;
  var x = 0;
  if(N<1){
  }else{
    x = parseInt(Math.floor(Math.sqrt(N)));  
    for(x = 1; x<10^12; x++){
      if(N % x == 0){
        x=i;
      }else{}
    }
  }
  j=N/i;
  susumi = i+j-2;
  console.log(susumi);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));