import java.util.*; public class Main { private final static Main main = new Main(); public static void main(String[] args) { main.contest(); } private void contest() { Scanner sc = new Scanner(System.in); System.out.println(solve(sc.nextLong())); } private long solve(long n) { for(int i=3; i<=Math.sqrt(n)+1; ++i) { if(n%i == 0) { return i; } } return n%2 == 0 ? n/2 : n; } }