#include <iostream>

using namespace std;

int main()
{
    long long v, u, m=5;
    cin>>v;
    u=v;
    int br=0;
    u/=10;
    while(u){
        u/=10;
        m*=10;
    }

    while(m){
        br=br+(v/m);
        v=v%m;

        m= (m/5)*2;
        br=br+(v/m);
        v=v%m;

        m= m/2;
        br=br+(v/m);
        v=v%m;

        m= m/2;
    }
    cout<<br;
    return 0;
}