n = int(input()) f = 3 while f * f <= n: if n % f == 0: print(f) exit() f += 1 if n % 2 == 0 and n != 4: print(n // 2) else: print(n)