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