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

using namespace std;
int f(int cif)
{
    int br=0;
    while(cif>=5) {br++; cif=cif-5; }
    while(cif>=2) {br++; cif=cif-2; }
    while(cif>=1) {br++; cif=cif-1; }
    return br;
}
int main()
{
    char nov[18];

    int s=0,i=0;
    gets(nov);

    while(nov[i])
    {
        s=s+f(nov[i]%48);
        i++;
    }
    printf("%d",s);

    return 0;
}