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