#include <iostream>
using namespace std;

int main(){
    int n;

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