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

  int in;
  while(cin >> in,in){
    int co=0;
    for(int i=1;i<=in;i++){
      int tmp=i;
      while(tmp%5==0){
	co++;
	tmp/=5;
      }
    }
    cout << co << endl;
  }
}