#include<iostream>

using namespace std;

int main()
{
	int n,cnt;
	
	while (1) {
		cin >> n;
		if (n == 0) {
			break;
		}
		
		cnt = 0;
		while (n >= 5) {
			cnt += n / 5;
			n /= 5;
		}

		cout << cnt << endl;
	}
	return 0;
}
