import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; class Main { static PrintWriter out = new PrintWriter(System.out); static String str; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long len = Long.parseLong(br.readLine()); int i; double sqr=Math.sqrt(len); for(i=3;i<=sqr;i+=2){ if(len%i==0){ System.out.println(i); return; } } System.out.println(len); } }