import math N=int(input()) #素数の表の作成 n_sqrt = math.ceil(math.sqrt(N)) isPrime = [True for i in range(n_sqrt+1)] primes = [] primes.append(2) for i in range(4,n_sqrt+1,2): isPrime[i]=False #2 if N%2==0: N=int(N/2) if N%2==0: if N%3==0: print(3) else: print(4) exit() #3以上 for i in range(3,n_sqrt+1,2): if isPrime[i]==True: primes.append(i) if N%i==0: print(i) exit() for j in range(i+i,n_sqrt,i): isPrime[j]=False print(N)