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

namespace _1zadTakm
{
    class Program
    {
        static void Main(string[] args)
        {
            long v = long.Parse(Console.ReadLine());
            int n = v.ToString().Length;
            int d=0;
            for(int i = 0;i<n;i++)
            {
                long k = v % 10;
                v /= 10;
                if (k == 1 || k == 2 || k == 5) d += 1;
                else if (k == 3 || k == 4 || k == 6 || k == 7) d += 2;
                else if (k == 8 || k == 9) d += 3;               
            }
            Console.WriteLine(d);
            
        }
    }
}