from math import sqrt n = int(input()) x = 3 while x <= sqrt(n): if n % x == 0: break x += 1 print(x)