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