Problem:
Score : 500 points

Problem Statement

For an integer n not less than 0, let us define f(n) as follows:

f(n) = 1 (if n < 2)

f(n) = n f(n-2) (if n \geq 2)

Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N).

Constraints

0 \leq N \leq 10^{18}

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of trailing zeros in the decimal notation of f(N).

Sample Input 1

12

Sample Output 1

1

f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.

Sample Input 2

5

Sample Output 2

0

f(5) = 5 × 3 × 1 = 15, which has no trailing zeros.

Sample Input 3

1000000000000000000

Sample Output 3

124999999999999995

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

ll n;
ll pow2(ll a,ll b){
    ll ret=1;
    for(int i=0;i<b;i++)ret*=a;
    return ret;
}

ll ko(ll i){
    return i/4LL*10LL+(i%4LL+1LL)*2LL;
}

int main(){
    


    cin>>n;

    ll ans=0;
    for(ll f=1;f<=1000;f++){
        ll bai=pow2(5LL,f);
        if(bai>n)
            break;

        ll l=0,r=n/bai+1,mid=(r+l)/2;
        while(abs(r-l)>1){
            if(ko(mid)*bai>n)
                r=mid;
            else
                l=mid; 
            mid=(r+l)/2LL;           
        }
        //cout<<(mid+1)<<endl;
        //cout<<bai<<" "<<mid<<endl;
        ans+=(mid+1)*f;
    }
    cout<<ans<<endl;

    return 0;
}