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

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            long v = Convert.ToInt64(Console.ReadLine());
            long cifre = Convert.ToInt64(Math.Floor(Math.Log10(v) + 1));
            long br = cifre;
            long ostatak = 0;
            long n = 1;
            
            long novcanice = 0;

            for (long i = 0; i < br; i++)
            {
                
                ostatak =Convert.ToInt64(v % Math.Pow(10, n));
                v /= 10;
                if (ostatak == 8 || ostatak == 9)
                    novcanice += 3;
                else
                if (ostatak == 3 || ostatak == 4 || ostatak == 6 || ostatak == 7)
                    novcanice += 2;
                else
                if (ostatak == 1 || ostatak == 2 || ostatak == 5)
                    novcanice++;
                else if (ostatak == 0)
                {
                    novcanice++;
                    break;
                }




            }
            Console.WriteLine(novcanice);
        }
    }
}