using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            double x;
            int[] cifra = { 5, 2, 1 };
            int br = 0;
            double y;
            x = Convert.ToDouble(Console.ReadLine());

            double desetice = Math.Pow(10, 18);

            while (x != 0)
            {
                for (int i = 0; i < 3; i++)
                {
                    
                    y = cifra[i] * desetice;
                    if (x >= y)
                    {
                        br++;
                        i--;
                        x -= y;

                    }
                }
                desetice /= 10;
            }

            Console.WriteLine(br);

            Console.ReadKey();
        }
    }
}