import math def main(): N = int(input()) n = int(math.sqrt(N)) for i in range(3, n + 1): if not N % i: break else: i = N print(i) main()