print((function (n) local i=3 while i^2<=n do if n%i==0 then return i end i=i+1 end return n~=4 and n%2==0 and n/2 or n end)(io.stdin:read("*n")))