int int_n = int(input();
double s =  sqrt(int_n);
int i = s
while(i >= 1)
{
      if (int_n % i == 0){
        int j = int_n/i
        print(math.floor((i - 1) + (j - 1)))
        break;
      }
          i = i - 1
}
