N = int(input()) n = int(N**(1/2)) ans = N for i in range(3, n+3): if N%i == 0: ans = i break print(ans)