#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
#define INF	100000000
#define pb	push_back
#define fi first
#define sec second
#define SS stringstream
using namespace std;
typedef pair<int, int> P;
typedef long long int	ll;

ll n;

int main(){
	while(cin >> n){
		if(n == 0) break;
		int ans = 0;
		while(true){
			if(n < 5) break;
			ans += n/5;
			n = n/5;
		}
		cout << ans << endl;
	}
}