#include <iostream>

using namespace std;

int main()
{
    long long V;
    int s;
    long p=0;
    cin>>V;
    while(V>9)
    {
        s=V%10;
        V=V/10;
        p+=s/5;
        s=s-(s/5)*5;
        p+=s/2;
        s=s-(s/2)*2;
        p+=s;
    }
    p+=V/5;
    V=V-(V/5)*5;
    p+=V/2;
    V=V-(V/2)*2;
    p+=V;
    cout<<p<<endl;
    return 0;
}