#include <iostream>

int main()
{
	long long n,pom, j=1;
	int k=0, nov=0;
	std::cin >> n;
	pom = n;
	while (pom > 0) {
		j *= 10;
		pom /= 10;
		k ++;
	}
	long long  d, p;
	j /= 10;
	d = 2 * j;
	p = 5 * j;
	
	while (k > 0)
	{
		nov += (n / p);
		n = n % p;
		nov += n / d;
		n = n % d;
		nov += n /j;
		n = n % j;
		p /= 10;
		d /= 10;
		j /= 10;
		k--;
	//	std::cout << nov << " " << n << " " << d << " " << p << " " << std::endl;
	}
	std::cout << nov;
	//system("Pause");
}