using System;

namespace isplata
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64 v = Int64.Parse(Console.ReadLine());
            int[] d = new int[3];
            int i, st, j, brnov = 0, a;
            d[0] = 1;
            d[1] = 2;
            d[2] = 5;
            while (v > 0)
            {
                a = 1;
                st = 1;
                j = 0;
                for (i = 1; i <= v; i = d[j] * st)
                {
                    a = i;
                    j++;
                    if (j == 3)
                    {
                        j = 0;
                        st *= 10;
                    }
                }
                v -= a;
                brnov++;
            }
            Console.WriteLine(brnov);
        }
    }
}