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