a = int(input()) tmp =[] #m=2のときは別途 l = 1 r = 10**9 while r - l > 1: c = (l+r)//2 if c**2 <= a: l = c else: r = c tmp.append(r*2) #m=3のときは別途 l = 1 r = 10**6 while r - l > 1: c = (l+r)//2 if c**3 <= a: l = c else: r = c tmp.append(r*3) n = 2 for m in range(70, 3, -1): while n**m <= a: n += 1 tmp.append(n*m) n -= 1 # m=1のときはn=a+1になる。これも忘れずに。 print(min(min(tmp), a+1))