n = int(input()) tmax = n - 1 tmin = 10**15 i = 1 f = [] while i * i <= n: if n % i == 0: f.append(i) i += 1 for i in f: if n % i == 0: fac1 = i fac2fac3 = n // fac1 for j in f: if fac2fac3 % j == 0: fac2 = j fac3 = fac2fac3 // fac2 tmin = min(fac1 + fac2 + fac3 - 3, tmin) #print(fac1,fac2,fac3) print(tmin, tmax)