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

namespace Isplata
{
    class Program
    {
        static void Main(string[] args)
        {
            long v = Convert.ToInt64(Console.ReadLine());
            int[] d = new int[3] { 1, 2, 5 };
            int izlaz = 0;
            string vv = v.ToString();
            int duzina = vv.Length;
            
            while (v > 0)
            {
                for(int i = 2; i >= 0; i--)
                {
                    long novcanica = d[i] * Convert.ToInt64(Math.Pow(10, duzina-1));
                    if(v - novcanica >= 0)
                    {
                        v -= novcanica;
                        vv = v.ToString();
                        duzina = vv.Length;
                        //Console.WriteLine(novcanica);
                        izlaz++;
                        break;
                    }
                }
            }
            Console.WriteLine(izlaz);
            


        }
    }
}