#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int n;
  while(cin >> n && n!=0) {
    int a=n, b=0,c=0;
    while(a>=2) {
      b+=a/2;
      a/=2;
    }
    a=n;
    while(a>=5) {
      c+=a/5;
      a/=5;
    }
    cout << min(c,b) << endl;
  }
  return 0;
}
