#include<stdio.h>
main()
{
    int v,j=0,s=0;
    scanf("%d",&v);
    while(v)
    {
        j=v%10;
        if(j==0) s=s+0;
        else
        if(j==5) s=s+1;
        else
        if(j>7) s=s+3;
        else
        if(j>2) s=s+2;
        else s=s+1;
        v=v/10;
    }
    printf("%d",s);
}