A=int(input()) ANS=1<<30 for i in range(2,100): for j in range(1,100): if pow(i,j)>=A: ANS=min(ANS,i*j) break print(ANS)