#include <cstdlib>
#include <iostream>
using namespace std;

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	for(int n; cin >> n && n;) {
		long long x = 5;
		long long sum = 0;
		while(x <= n) {
			sum += n / x;
			x *= 5;
		}
		cout << sum << endl;
	}

	return EXIT_SUCCESS;
}