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