#include <bits/stdc++.h>
using namespace std;

int d[] = {1, 2, 5};

void magnitudeLog(long long x ,int &magnitude, long long &p){
	magnitude = floor(log10(x));
	p = floor(pow(10,magnitude));
}

int main() {
	long long V = 0;
	cin >> V;
	
	int magnitude = 0;
	long long p = 0;
	
	magnitudeLog(V,magnitude,p);
	
	int count = 0;
	
	
	while(V > 0){
		if(V < p){
			magnitudeLog(V,magnitude,p);
		}

		for(int di = 2 ; di >= 0; di--){
			int rm = V / (d[di] * p);
			if(rm == 0) continue;
            V -= rm * p * d[di];
			count+=rm;
		}
	}
	
	cout << count << endl;
}