N = int(input()) print(([i for i in range(3, 6 ** 8) if N % i < 1] + [N % 2 * N or N // 2])[0])