import math N = input() for i in xrange(3, int(math.sqrt(N)+1)): if N%i == 0: print i exit() print N