#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n, n)
    {
        int ans = 0;
        int tmp = 1;
        for(int i = 1; tmp <= 20000; i++)
        {
            tmp = pow(5, i);
            ans += n / tmp;
        }
        cout << ans << endl;
    }
    return 0;
}


