import math N = int(raw_input()) flag = False for i in range(3,long(math.sqrt(N)) + 1): if N % i == 0: flag = True print i break if not flag:print N