A = int(input()) count = 1 num = A ans = 10**18 while num > 1: num //= 2 count += 1 for i in range(1,count+1): for j in range(1,count+1): if i**j >= A: ans = min(ans,i*j) print(ans)