n=int(input()) for i in range(3,int((n*n)**.5)+1): if n%i<1: n=i; break print(n)