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

namespace ConsoleApplication2
{
    class Program
    {
        static int kbroj(long a)
        {
            int br = 0;
            while(a>=1)
            {
                a /= 10;
                br++;
            }
            return br;
        }
        static void Main(string[] args)
        {
            long V = Convert.ToInt64(Console.ReadLine());
            long[] d = { 1, 2, 5 };
            int k = kbroj(V) - 1;
            int br = 0;
            long p = 0;
            for (k = kbroj(V) - 1; k >= 0; k = kbroj(V) - 1)
                for (int i = 2; i >= 0; i--)
                {
                    p = d[i] * (long)Math.Pow(10, k);
                    if (V / p > 0)
                    {
                        br += Convert.ToInt32(V / p);
                        V = V % p;
                    }
                }
            Console.WriteLine(br);
        }
    }
}