using System;
class Program
{
    static void Main(string[] args)
    {
        int n,d=10,br,i=0,c;
        while(n>0)
        {
            n/=d;
            d*=10;
            c++;
        }
        int []b=new int[c];
        n=int.Parse(Console.ReadLine());
        for(i=0;i<c;i++)
        {
            b[i]=n%d;
            n/=d;
            if(b[i]==1 || b[i]==2 || b[i]==5)
                br++;
            if(b[i]==3 || b[i]==4 || b[i]==6 || b[i]==7)
                br+=2;
            if(b[i]==8 || b[i]==9)
                i+=3;
            d*=10;
        }
        Console.WriteLine(br);
    }
}