#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

int main(void){
	int n;
	while(1){
		cin >> n;
		if(n==0)break;
		int ans=0;
		bool ac=true;
		while(ac){
			if(n%5!=0)ac=false;
			ans+=n/5;
			n=n/5;
		}
		printf("%d\n",ans);
	}
	return 0;
}