n = int(input()) f = 3 while f * f <= n: if n % f == 0: print(f) exit() f += 1 print(n)