import math as m n=input() print next(iter(i for i in range(3,int(m.sqrt(n))+1)if n%i<1))or n