using System;




    class Program
    {
        static void Main()
        {
            int v, k, i, kol, m, c;
            Console.WriteLine("Unesite sumu: ");
            v = int.Parse(Console.ReadLine());
            kol = 0;
            m = v.ToString().Length;
             k = v.ToString().Length;
            while(m>0)
            {
                c = (int)(v / Math.Pow(10, (m - 1)));
                for(i=k;i>=0;i--)
                {
                    if(c>=5)
                    {
                        c -= 5;
                        kol++;
                    }
                    else if(c>=2)
                    {
                        c -=  2;
                        kol++;
                    }
                    else if(c>=1)
                    {
                        c -=  1;
                        kol++;
                    }
                }
                m--;
            }
            Console.WriteLine(kol);
            Console.ReadLine();

        }
    }