N=input();i=3 while i*i<=N: if N%i==0:a=i;break; i+=1 else:a=[N/2,N][N%2+(N==4)] print a