n=input() if n%3==0: print 3 exit() if n%4==0: print 4 exit() for i in xrange(5,int(n**0.5)+2,2): if n%i==0: print i break else: if n%2==0: print n/2 else: print n