N = gets.to_i ans = (3..Math.sqrt(N).ceil).find {|n| N % n == 0} || N puts ans