#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    while (scanf("%d", &n), n) {
        int ans = 0, divi = 5;
        while (n / divi) {
            ans += n / divi;
            divi *= 5;
        }

        cout << ans << endl;
    }

    return 0;
}
