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