N = int(input()) for i in range(3,10**6+1): if N % i == 0: print (i) break else: print (N)