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(int i=3; i<=(int) Math.sqrt(n); ++i) { if(n%i == 0) { return i; } } return n; } }