#include <iostream>
using namespace std;

int main(void)
{
	int n;

	while (cin >> n)
	{
		if (n == 0) break;
		int k = 5, d = 0;
		while (n >= k)
		{
			d += n / k;
			k *= 5;
		}
		cout << d << endl;
	}
	return 0;
}
