import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); long n=sc.nextLong(); long ans=0; for(int i=3;i<=Math.sqrt((double)n);i++){ if(n%i==0){ ans=i; break; } } if(ans==0){ if(n%2==0){ ans=n/2; }else{ ans=n; } } System.out.println(ans); } }