def solve(): ans = float('inf') A = int(input()) for i in range(1,100): p = int(A**(1/i)) for q in range(p,p+3): if q**i>=A: ans = min(ans, q*i) break return ans print(solve())