import java.util.Scanner; public class Main_yukicoder312 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); for (long j = 3; j * j <= n; j++) { if (n % j == 0) { System.out.println(j); sc.close(); return; } } System.out.println(n); sc.close(); } }