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); long n = sc.nextLong(); System.out.println(Math.min(solve(n), n/2)); } private long solve(long n) { for(int i=3; i<=Math.sqrt(n)+1; ++i) { if(n%i == 0) { return i; } } return n; } }