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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64 n = Int64.Parse(Console.ReadLine());
            Int64 m = n;
            int brR = 0;
            Int64 d = 0;
            int p = 1;
            int br = 0;
            Int64 stepen = 0;
            while(p == 1)
            {
                brR++;
                m = m / 10;
                if(m == 0)
                {
                    p = 0;
                }
            }
            stepen = (Int64)Math.Pow(10,brR);
            p = 1;
            while(p == 1)
            {
                d = n / (Int64)stepen;
                switch(d)
                {
                    case 1: br++; break;
                    case 2: br++; break;
                    case 3: br += 2; break;
                    case 4: br += 2; break;
                    case 5: br++; break;
                    case 6: br += 2; break;
                    case 7: br += 2; break;
                    case 8: br += 3; break;
                    case 9: br += 3; break;
                }
                n = n / (Int64)stepen;
                stepen = stepen / 10;
                if(n == 0)
                {
                    p = 0;
                }
            }
            Console.WriteLine(br);
        }
    }
}