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

namespace PetljaTakmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();

            int counter = 0;

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

            for (int i = 0; i < input.Length; ++i)
            {
                counter += values[int.Parse(input[i].ToString())];
            }

            Console.WriteLine(counter);

            Console.ReadKey();
        }
    }
}