n=a=int(input()) if n%2<1: a//=2 for i in range(3,int(n**.5)+1): if n%i<1: a=i; break print(a)