N = gets.to_i ans = (3..Math.sqrt(N).ceil).find {|n| N % n == 0} || ((N % 2 == 0 and N >= 5) ? N / 2 : N) puts ans