#include <iostream>
#include <math.h>
using namespace std;
int brcif(long long n){
	int br=0;
	while(n>0){
		n/=10;
		br++;
	}
	return br;
}
int main(){
	long long s;
	int br=0;
	cin>>s;
	while(s!=0){
		switch(s%10){
			case 0:
				break;
			case 1:
				s-=1;
				br++;
				break;
			case 2:
			case 3:
			case 4:
				s-=2;
				br++;
				break;
			default:
				s-=5;
				br++;
				break;
		}
		if(s%10==0)s/=10;
	}
	cout<<br;
}