import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long N = scan.nextLong(); scan.close(); for(int i = 3; i <= N / 2; i++) { if(N % i == 0) { System.out.println(i); System.exit(0); } } System.out.println(N); } }