n = int(raw_input()) d = 3 while d * d <= n: if n % d == 0: print d break d += 2 else: print n