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

namespace prog_Ik_1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());

            int[] m = { 0,1,1,2,2,1,2,2,3,3};

            long i;

            int s=0;

            while(n!=0)
            {
                i = n % 10;
                s += m[i];
                n /= 10;
            }

            Console.WriteLine(s);
        }


    }
}