A = int(input()) X = A for N in range(1, int(A ** 0.5)): if N > X: break X = min(X, N * (int(A ** (1 / N)) + 1)) print(X)