#include <stdio.h>
int dozvoljen(int br)
{
	int pb;
	do
	{
		if(br < 10) pb = br;
		else
		{
			if(br%10 != 0) return 0;
			br = br / 10;
			if(br <= 10) pb = br;
		}
	}
	while(br >= 10);
	if(pb == 1 || pb == 2 || pb == 5) return 1;
	else return 0;
}
main()
{
	int v,i,z = 0;
	scanf("%d",&v);
	do
	{
		for(i = v; i >= 1; i--)
		{
			if(dozvoljen(i))
			{
				v = v - i;
				z ++;
				break;
			}	
		}
	}
	while(v > 0);
	printf("%d\n",z);
}