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