import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long N = scan.nextLong(); int M = (int)Math.sqrt(N); boolean primeList[] = new boolean[M+1]; for(int i=2; i<=M; i++) { primeList[i] = true; } for(int i=2; i<=M; i++) { if(primeList[i]) { for(int j=i+i; j<=M; j=j+i) { primeList[j] = false; } } } for(int i=3; i<=M; i++) { if(primeList[i]) { if(N%i == 0) { System.out.println(i); break; } } } } }