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