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