#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    unsigned long int V;
    cin >> V;
    unsigned long int brojac = 0;
    unsigned long int ostatak = V;
    unsigned long int delilac5;
    unsigned long int delilac2;
    unsigned long int delilac1;
    long double base = 10;
    unsigned long int mnozilac;
    for (long double i = 10; i >= 0; i--)
    {
        mnozilac = pow(base, i);
        delilac5 = 5 * mnozilac;
        if ((ostatak % delilac5) < ostatak)
        {
            brojac = brojac + (ostatak / delilac5);
            ostatak = ostatak % delilac5;
        }
        delilac2 = 2 * (int)mnozilac;
        if ((ostatak % delilac2) < ostatak)
        {
            brojac = brojac + (ostatak / delilac2);
            ostatak = ostatak % delilac2;
        }
        delilac1 = 1 * (int)mnozilac;
        if ((ostatak % delilac1) < ostatak)
        {
            brojac = brojac + (ostatak / delilac1);
            ostatak = ostatak % delilac1;
        }
    }
    cout << brojac;
}