#include <iostream>
using namespace std;

int main() {
int n;
while(1){
	cin>>n;
	if(n==0){
		break;
	}
	int k=0,go=5;
	for(int jj=1;jj<=14;jj++){
		k=k+n/go;
		go=go*5;
	}
cout<<k<<endl;
}
return 0;
}