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