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

namespace ConsoleApplication15
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] d = { 1, 2, 5 };
            int V = int.Parse(Console.ReadLine());
            string v = V.ToString();
            int r = 0;
            for (int k = v.Length-1; k >= 0; k--)
            {
                for (int j = 2; j >=0; j--)
                {
                    if (V / (int)(d[j] * Math.Pow(10, k)) > 0)
                    {
                        r += V / (int)(d[j] * Math.Pow(10, k));
                        V = V % (int)(d[j] * Math.Pow(10, k));
                    }

                }
            }
            Console.WriteLine(r);
            Console.ReadLine();
        }
    }