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

int a[20000];

int main()
{
  int n;

  for (int i = 1; i <= 5; i++){
    int p = pow(5, i);
    for (int j = 1; j * p < 20000; j++){
      a[j * p]++;
    }
  }

  for (int i = 1; i < 20000; i++){
    a[i] += a[i - 1];
  }

  while (cin >> n && n != 0){
    cout << a[n] << endl;
  }
}