#include<stdio.h>
#include<math.h>
int main()
{
	long long int v,s=0,k=20,d,j=0;
	scanf("%lld",&v);
	while(k >= 0)
	{
		d = 5;
		while(d > 0)
		{
			while(v - d*pow(10,k) >= 0)
			{
				v = v - d*pow(10,k);
				s++;
			}
			if(d == 5)d = 2;
			else d--;
		}
		k--;
	}
	printf("%lld",s);
}