import java.util.*; public class Main { public static void main(String... args) { System.out.println(calc(new Scanner(System.in).nextLong())); } private static long calc(long n) { for(long i=3; i<=(long) Math.sqrt(n); ++i) { if(n%i == 0) { return i; } } return n; } }