using System;

class _0052 {
    public static void Main() {
        int n, sum;

        while ((n = int.Parse(Console.ReadLine())) != 0) {
            sum = 0;
            for (float b = 5; b <= n; b *= 5)
                sum += (int)(n / b);
            Console.WriteLine(sum);
        }
    }
}