#include <iostream>

using namespace std;

int main()
{
    unsigned long long a,res=0,h=1;
    cin>> a;
    int k=0;

    while(a%h!=a){
        h*=10;
    }
    while(a){
        res+=a/(5*h);
        a%=5*h;
        res+=a/(2*h);
        a%=2*h;
        res+=a/(1*h);
        a%=1*h;
        h/=10;

    }
    cout << res << endl;
    return 0;
}