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