#include<iostream>
using namespace std;
int sabirci(int x)
{
	int k=0;
	while(x>0)
	{
		if(x>=5)
		{
			x=x-5;
			k++;
		}
		else if(x>=2)
		{
			x=x-2;
			k++;	
		}
		else if(x>=1)
		{
			x=x-1;
			k++;	
		}
	}
	return k;
}
int main()
{
	long long V;
	cin>>V;
	int k=0;
	while(V>0)
	{
		k+=sabirci(V%10);
		V=V/10;
	}
	cout<<k<<endl;
}