#include <stdio.h>
#include <stdlib.h>

int main()
{
    int V, n, Vost1, Des, Sto;
    scanf("%d", &V);
    Vost1=V%10;
    V=V-Vost1;
    Des=V%100;
    Sto=V-Des;
    n=0;
    if(V<0)
        printf("Uneta je negativna suma");
    else
    {
    if(Vost1==1)
        n=n+1;
    else
    {
        if(Vost1==2)
            n=n+1;
        else
    {
        if(Vost1==3)
            n=n+2;
        else
    {
        if(Vost1==4)
            n=n+2;
        else
    {
        if(Vost1==5)
            n=n+1;
        else
    {
        if(Vost1==6)
            n=n+2;
        else
    {
        if(Vost1==7)
            n=n+2;
        else
    {
        if(Vost1==8)
            n=n+3;
            else
    {
        if(Vost1==9)
            n=n+3;
    }
    }
    }
    }
    }
    }
    }
    }
    if(Des==10)
        n=n+1;
    else
    {
        if(Des==20)
            n=n+1;
        else
    {
        if(Des==30)
            n=n+2;
        else
    {
        if(Des==40)
            n=n+2;
        else
    {
        if(Des==50)
            n=n+1;
        else
    {
        if(Des==60)
            n=n+2;
        else
    {
        if(Des==70)
            n=n+2;
        else
    {
        if(Des==80)
            n=n+3;
            else
    {
        if(Des==90)
            n=n+3;
    }
    }
    }
    }
    }
    }
    }
    }
    if(Sto==100)
        n=n+1;
    else
    {
        if(Sto==200)
            n=n+1;
        else
    {
        if(Sto==300)
            n=n+2;
        else
    {
        if(Sto==400)
            n=n+2;
        else
    {
        if(Sto==500)
            n=n+1;
        else
    {
        if(Sto==600)
            n=n+2;
        else
    {
        if(Sto==700)
            n=n+2;
        else
    {
        if(Sto==800)
            n=n+3;
            else
    {
        if(Sto==900)
            n=n+3;
    }
    }
    }
    }
    }
    }
    }
    }
    }
    printf("%d", n);
    return 0;
}