#include <bits/stdc++.h>

using namespace std;

unsigned long long v, arr[65], tren=1, ress;

int main()
{
    cin>>v;

    int k=0;
    for (int i=0; i<19; i++)
    {
        arr[k++]=tren;
        arr[k++]=tren*2;
        arr[k++]=tren*5;
        tren*=10;
    }

    /*for (int i=k-1; i>=0; i--)
        cout<<arr[i]<<" ";
    cout<<endl;*/

    for (int i=k-1; i>=0; i--)
    {
        int sad=v/arr[i];
        ress+=sad;
        v-=(v/arr[i]*arr[i]);
    }

    cout<<ress;
}