import java.util.Scanner; public class Test { public static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long n = sc.nextLong(), m = 0; while ((m + 100000) * (m + 100000) <= n) { m += 100000; } while ((m + 10000) * (m + 10000) <= n) { m += 10000; } while ((m + 1000) * (m + 1000) <= n) { m += 1000; } while ((m + 100) * (m + 100) <= n) { m += 100; } while ((m + 10) * (m + 10) <= n) { m += 10; } while ((m + 1) * (m + 1) <= n) { m++; } boolean[] b = new boolean[(int)m + 1]; for (int i = 3; i <= m; i++) { if (!b[i]) { if (n % (long) i == 0) { System.out.println(i); return; } for (int j = i * 2; j <= m; j += i) { b[j] = true; } } } if(n > 4 && n % 2 == 0){ System.out.println(n/2); } else { System.out.println(n); } } }