#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;



int main(){
	int n,count,h;
	while(1){
		count=0;
		cin >> n;
		if(n==0)break;
		for(int i=4;i<=n;i++){
			h=i;
			while(h%5==0){
				h /= 5;
				count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}
