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