N = int(input()) sqrtN = int(N ** 0.5) for d in range(3, sqrtN + 1): if N % d == 0: print(d) break else: print(N)