n = gets.to_i 3.upto(n) do |i| next if 0 != n % i puts i exit 0 end