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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long  V = long.Parse(Console.ReadLine());
            int br = 0;
            while (V != 0)
            {
                long pom = V % 10;
                if (pom == 1 || pom == 2 || pom == 5) br++;
                else if (pom == 3 || pom == 4 || pom == 6 || pom == 7) br += 2;
                else br += 3;
                V = V / 10;
            }
            Console.WriteLine(br);
        }
    }
}