import java.io.*; public class No312 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); boolean flag = false; long ans = n; for(int i = 3 ; i*i <= n ; i++){ if(n % i == 0){ ans = i; flag=true; break; } } if(!flag && n%2 == 0 && n!= 4) ans = n / 2; System.out.println(ans); } }