n = gets.to_i
nh = Math.sqrt(n).to_i
3.upto(nh) do |x|
    if n % x == 0
        puts x
        exit
    end
end
if n % 2 == 0 && n / 2 > 2
    puts n / 2
    exit
end
puts n