object Main {
    val div_2 = Array.ofDim[Int](20001)
    val div_5 = Array.ofDim[Int](20001)
    for(i <- 2 to 20000) {
        div_2(i) = div_2(i - 1) + div_k(2, i)
        div_5(i) = div_5(i - 1) + div_k(5, i)
    }

    def div_k(k: Int, n: Int): Int = {
        var c = 0
        var i = n
        while(i % k == 0) {
            i /= k
            c += 1
        }
        c
    }
    def main(args:Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        var n = sc.nextInt
        while (n != 0) {
            println(div_2(n) min div_5(n))
            n = sc.nextInt
        }
    }
}