#include <stdio.h>
#include <stdlib.h>

int d[3]={1, 2, 5};

void novac(unsigned long long int x, unsigned long long int *y, unsigned long long int *z){
    unsigned long long int i, st;
    long double koef=0, step=1;
    for (i=0; ;i++){
        if ((i+1)>2){
            if (x<(d[0]*step*10)) break;
            else {
                step*=10;
                i=-1;
            }
        }
        else
            if (x<d[i+1]*step) break;
    }
    st=step;
    *y=d[i]*st;
    *z=x/(*y);
}

int main()
{
    unsigned long long int br, s=0, j, l;
    scanf("%llu", &br);
    while (br!=0){
        novac(br, &j, &l);
        s+=l;
        br=br%j;
    }
    printf ("%llu", s);
    return 0;
}