#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	unsigned long long d,k,v,br=0,del1=10000000000000,del2=20000000000000,del3=50000000000000,v1,v2,v3;
	cin>>v;
	if(v>=1){
		while(v>=1){
			if(v>=del3){
				br=br+1*(v/del3);	
					v=v-(del3*(v/del3));                                                   
		}
				del3=del3/10;
			if(v>=del2){
				br=br+1*(v/del2);
					v=v-(del2*(v/del2));
		}
				del2=del2/10;
			if(v>=del1){
				br=br+1*(v/del1);
					v=v-(del1*(v/del1));
			
		}
			del1=del1/10;
	}	
	cout<<br;
}
	return 0;
}