# Here your code !
class Factorial
    class << self
        def run
            
            loop do
                input = "#{gets}".to_i
                return if input == 0
                p fact(input).to_s.split("").select{|val| val.to_s == "0"}.count
            end
        end
        def fact(val)
            return 1 if val == 1
            val * fact(val-1)
        end
    end
end


if __FILE__ == $0
    Factorial.run
end