N = int(input()) import sys d = 3 while d * d <= N: if N % d == 0: print(d) exit() d += 1 print(N)