using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            int d = 1, k;
            long ostatak = n;
            long i = n;
            int nov = 0;
            string s = i.ToString();
            d = s.Length - 1;
            while (d > 0)
            {
                k = 5;
                double w = Math.Pow(10, d);
                while (k > 0 && n != 0)
                {
                    if (n % (long)(k * w) == n)
                    {
                        if (k == 5) k = 2;
                        else k--;
                    }
                    else
                        while (n % (k * w) != n)
                        {
                            int x = (int)(n / (k * w));
                            nov += (int)(x);
                            n = n - (long)(k * w * x);
                        }
                }
                i = n;
                s = i.ToString();
                d = s.Length - 1;
            }
            ostatak = n;
            k = 5;
            while (k > 0 && ostatak != 0)
            {
                if (ostatak % (long)k == ostatak)
                {
                    if (k == 5) k = 2;
                    else k--;
                }
                else
                    while (ostatak %(long)k != ostatak && ostatak != 0) 
                    {

                        int x = (int)(ostatak / (long)k);
                        nov += (int)(x);
                        ostatak = ostatak - (long)(k * x);
                    }
            }
            Console.WriteLine(nov);
        }
    }
}