#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){

  int n;
  for(;cin>>n,n;)
    {
      int fire=0;
      int two=0;
      for(int i=2;i<=n;i++)
	{
	  int tmp=i;
	  while(tmp%2==0)
	    {
	      tmp=tmp/2;
	      two++;
	    }
	  while(tmp%5==0)
	    {
	      tmp=tmp/5;
	      fire++;
	    }
	}
      cout<<min(two,fire)<<endl;
    }

}