import math N = int(input()) ans = N root = int(math.sqrt(N)) for i in range(3, root + 1, 2): if N % i == 0: ans = i break print(ans)