N = int(input()) for i in range(3, int(N ** 0.5) + 2): if N % i == 0: print(i) exit() if N % 2: print(N) else: print(N // 2)