import sys import math a = int(input()) ans = 10**100 for i in range(2, 60): l = 0 r = 10**9 while r - l > 1: m = (l + r) // 2 if m**i >= a: r = m else: l = m ans = min(ans, r * i) print(ans)