#include <iostream>

using namespace std;

long long int stepen(int x)
{
    long long int br=1;
    while(x>0)
    {
        br*=10;
        x--;
    }
    return br;
}

int vrati(long long int x)
{
    int br=0;
    while(x>0)
    {
        br++;
        x/=10;
    }
    return br;
}

int main()
{
    long long int v, br=0, a[5]={5, 2, 1}, pom;
    cin >> v;
    for(int i=vrati(v);i>=0;i--)
    {
        for(int j=0;j<=2;j++)
        {
            pom=a[j]*stepen(i);
            br+=v/pom;
            v%=pom;
        }
    }
    cout << br;
    return 0;
}