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

namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());
            long k;
            int o=0;
            while(n>0)
            {
                k = n % 10;
                if (k == 1 || k == 2 || k == 5)
                    o++;
                else if (k == 3 || k == 4 || k == 6 || k == 7)
                    o = o + 2;
                else if (k == 8 || k == 9)
                    o = o + 3;
                n = n / 10;
            }
            Console.WriteLine(o);
        }
    }
}