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