#include <iostream>
using namespace std;

int main(void)
{
  int n, a=0;

  while(1)
    {
      cin >> n;
      if(n == 0) break;
      {
	while(n /= 5) a += n;
	cout << a << endl;
      }
    }
  return 0;
}