n = int(input())

ans = n
m = int(n**(1/3) + 1)
for i in range(1, m + 1):
    if n % i == 0:
        nn = n // i
        f = 1
        while f * f <= nn:
            if nn % f == 0:
                ans = min(ans, i + f + (nn // f) - 3)
            f += 1
print(ans, n - 1)