N = int(input()) def prime(n): if n == 1: return False i = 2 while i * i <= n: if n % i == 0: return False i += 1 return True if prime(N): print(N) exit() elif N % 2 == 0 and prime(N/2): print(N//2) exit() m = 3 while N % m != 0: m += 1 print(m)