#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n;
	for (; cin >> n; )
	{
		if (n == 0)
		{
			break;
		}

		int cnt = 0;
		for (int i = 0; i <= n; i += 5)
		{
			int j = i;
			for (; j > 0;)
			{
				if (j % 10 == 0)
				{
					cnt++;
					j /= 10;
				}
				else if (j % 5 == 0)
				{
					cnt++;
					j /= 5;
				}
				else
				{
					break;
				}
			}
		}

		cout << cnt << endl;
	}
}
