#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    long long n;

    while (cin >> n, n) {
        int cnt = 0;
        while (n / 5) {
            cnt += n / 5;
            n /= 5;
        }
        cout << cnt << endl;
    }

    return 0;
}