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

namespace takm
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int n = s.Length;
            int br = 0;
            for(int i=0;i<n;i++)
            {
                int k = s[i]-'0';

                br += k / 5;
                k -= 5 * (k / 5);

                br += k / 2;
                k -= 2 * (k / 2);

                br += k / 1;
            }

            Console.WriteLine(br);
        }
    }
}