// IsplataTakmicenje2019.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <math.h>


int findLength(int v)
{
	int br = 0;
	while (v>0)
	{
		v /= 10;
		br++;
	}

	return br;
}

int _tmain(int argc, _TCHAR* argv[])
{
	long V;
	int v;
	int br = 0;
	
	int i = 2;
	scanf_s("%d", &V);

	int nums[3] = { 1, 2, 5 };

	int a = findLength(V);

	long long st = pow(10.0,a-1);

	while (V > 0){
		if (i == -1){
			st /= 10;
			i = 2;
		}
		
		while ((V - nums[i] * st) >= 0 )
		{
			V -= nums[i] * st;
			br++;
		}
		i--;
	}
	printf(" %d ", br);
}