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(long i = 3; i <= Math.sqrt(N); i++) { if(N % i == 0) { System.out.println(i); System.exit(0); } } if(N % 2 == 0) { System.out.println(N / 2); }else { System.out.println(N); } } }