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