#include <iostream>
#include <vector>
#include <algorithm>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(){
	int n;
	int result = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

	for(;;){
#if INPUT_FROM_FILE
		ifs >> n;
#else
		std::cin >> n;
#endif
		if(n == 0){ break; }

		result = 0;
		for(int i = 5; i <= n; i++){
			int tmp = i;

			if(tmp % 5 == 0){
				while(tmp % 5 == 0){
					result++;
					tmp /= 5;
				}
			}
		}
		std::cout << result << std::endl;
	}

	return 0;
}
