a = int(input()) tmp =[] for m in range(2, 70): n = 2 while n**m <= a: n += 1 tmp.append(n*m) print(min(tmp))