/*
	AOJ_0052:Factorial II
*/
#include	<iostream>

using namespace std;

int main(){
	int n, sum;

	while (1) {
		cin >> n;
		if (n == 0) break;

		sum = 0;
		while (n >= 5) {
			n /= 5;
			sum += n;
		}
		cout << sum << endl;
	}

	return 0;
}