import math._ object Main { def calc(n: Long): Long = { if (n % 3 == 0) return 3 if (n % 4 == 0) return 4 var x = n while (x % 2 == 0) x /= 2 var p = 3L while (p * p <= x) { if (x % p == 0) return p p += 2 } x } def main(args: Array[String]) = { val sc = new java.util.Scanner(System.in) val n = sc.nextLong println(calc(n)) } }