#include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

typedef long long ll;

ll factorial(ll n,int a){
	if(a == 1)return n;
	return factorial(n*a,a-1);
}

int main(){
	int n;
	scanf("%d",&n);
	while(n != 0){
		int count = 0;
		bool T=1;
		ll sum = factorial(1,n);

		for(int i=1;T;i++){
			if(((ll)sum % (ll)pow(10,i)) == 0)count++;
			else T=0;
		}

		cout << count << endl;
		scanf("%d",&n);
	}

}