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)+1; 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; } } } if(N >= 5) { primeList[4] = true; } boolean find = false; int i; for(i=3; i<=M; i++) { if(primeList[i]) { if(N%i == 0) { find = true; break; } } } if(find) { System.out.println(i); } else { if(N % 2 == 0) { System.out.println(N/2); } else { System.out.println(N); } } } }