#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()
{
     long long int nov,s=0;
    scanf("%d",&nov);
    for(;nov;nov=nov/10)
    {
        s=s+f(nov%10);

    }
    printf("%d",s);
    return 0;
}