#include <iostream>
using namespace std;

int main() {
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int count=0;
		for(int i=2; i<=n; i++){
			int a = i;
			while(a%5 == 0){
				count++;
				a /= 5;
			}
		}
		cout << count << endl;
	}
	return 0;
}
