object Main {
    def main(args: Array[String]) = {
        val in = io.Source.stdin.getLines.map(_.toInt).toList.init
        in.foreach{n =>
            var x, y = 0
            def s(n: Int): Unit =
                if(n % 2 == 0) {x += 1; s(n/2)}
                else if(n % 5 == 0) {y += 1; s(n/5)}
            (2 to n).foreach(s)
            println(x min y)
        }
    }
}