#include<iostream>
using namespace std;
int main(){
    int n,ans;
    while(cin >> n,n!=0){
        ans = 0;
        for(int i=5;i<=n;i*=5) ans += n/i;
        cout << ans << endl;
    }
    return(0);
}
