#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;

long long int st(int i)
{
    return (long long int)round(pow(10, i));
}

int main()
{
    long long int br = 0, maxb = 0, maxi = 1, tmp, i;

    scanf("%lld", &tmp);

    i = 0;

    while(tmp / st(i) > 0)
        i++;

    maxb = i;
    i = 0;

    while(tmp / (2 * st(i)) > 0)
        i++;

    if(i >= maxb)
    {
        maxb = i;
        maxi = 2;
    }

    i = 0;

    while(tmp / (5 * st(i)) > 0)
        i++;

    if(i >= maxb)
    {
        maxb = i;
        maxi = 3;
    }

    i=maxb-1;
    if(maxi == 1)
        while(tmp > 0)
        {
            while(tmp - st(i) >= 0)
                tmp /= st(i), br++;

            if(i)
                i--;

            while(tmp - (5 * st(i)) >= 0)
                tmp /= 5 * st(i), br++;

            while(tmp - (2 * st(i)) >= 0)
                tmp /= 2 * st(i), br++;

        }
    else if(maxi == 2)
        while(tmp > 0)
        {
            while(tmp - (2 * st(i)) >= 0)
                tmp -= 2 * st(i), br++;

            while(tmp - st(i) >= 0)
                tmp -= st(i), br++;

            if(i)
                i--;

            while(tmp - (5 * st(i)) >= 0)
                tmp -= 5 * st(i), br++;
        }
    else
        while(tmp > 0)
        {
            while(tmp - (5 * st(i)) >= 0)
                tmp /= 5 * st(i), br++;

            while(tmp - (2 * st(i)) >= 0)
                tmp /= 2 * st(i), br++;

            while(tmp - st(i) >= 0)
                tmp /= st(i), br++;

            if(i)
                i--;
        }

    printf("%lld", br);
    return 0;
}