N = int(input()) for i in range(3,int(N**0.5)+1): if N%i==0: break else: i=N if N%2 or N<6 else N//2 print(i)