def fact(n)
    n10 = 0
    n5 = 0
    n2 = 0
    for ans in 1..n do
        #10**4
        for i in 0..4-1 do 
            pow=10**(4-i)
            ans,n10=ans/pow,n10+(4-i) if ans%pow==0
        end
        #5**6
        for i in 0..6-1 do 
            pow=5**(6-i)
            ans,n5=ans/pow,n5+(6-i) if ans%pow==0
        end
        #2**14
        for i in 0..14-1 do 
            pow=2**(14-i)
            ans,n2=ans/pow,n2+(14-i) if ans%pow==0
        end
    end
    n10 + [n2,n5].min
end

while true
    n = STDIN.gets.to_i
    exit 0 if n==0
    print fact(n),"\n"
end