n = int(input()) nn = int(n ** (1/2) + 3) tmax = n - 1 tmin = 10**12 for i in range(nn, 0, -1): if n % i == 0: fac1 = i for j in range(i, 0, -1): fac2fac3 = n // fac1 if fac2fac3 % j == 0: fac2 = j fac3 = fac2fac3 // fac2 tmin = min(fac1 + fac2 + fac3 - 3, tmin) #print(fac1,fac2,fac3) print(tmin, tmax)