#include <iostream>

using namespace std;

int main() {
  int data[20001] = {};

  for (int i = 1; i < 20001; ++i) {
    int v = 0;
    for (int a = i; a % 5 == 0; a /= 5)
      ++v;
    data[i] = data[i-1] + v;
  }

  while (true) {
    int x;
    cin >> x;
    if (x == 0)
      break;
    cout << data[x] << endl;
  }
}
