#include <iostream>
using namespace std;

int main(){
	int  n;
	while(cin >> n, n){
		int ans = 0;
		long long m = 5;
		while(m <= n){
			ans += n/m;
			m *= 5;
		}
		cout << ans << endl;
	}
	
	return 0;
}