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