import java.io.*; import java.util.*; class Main { public static void out (Object o) { System.out.println(o); } public static long solve (long n) { long k = n; while (k % 2 == 0) k /= 2; if (k == 1) return 4; for (long i = 3; i * i <= n; i += 2) { if (n % i == 0) return i; } return k; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); out(solve(n)); } }