#include<iostream>
using namespace std;

int pow(int a, int n) {
  int val = 1;
  for (int i = 0; i < n; i++)
    val *= a;

  return val;
}

int count5(int n) {
  int val = 0;
  for (int i = 1; pow(5,i) <= n; i++)
    for (int j = pow(5, i); j <= n; j += pow(5, i))
      val++;

  return val;
}

int main() {
  int n;
  while (cin >> n and n != 0) {
    cout << count5(n) << endl;
  }
}