import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(); long max = a; long x = 2; while (true) { long y = 2; int count = 1; while (y < a) { y *= x; count++; } if (max > count * x) { max = count * x; } else { break; } x++; } System.out.println(max); } }