#include <iostream>
using namespace std;

int main()
{
	string price;
	int total = 0;
	char current;
	int icurrent;
	int length;
	
	cin >> price;

	length = price.length();

	for (int i = 0; i < length; i++) {
		current = price[i];

		icurrent = current-'0';

		while (icurrent != 0) {
			if (icurrent >= 5) {
				icurrent = icurrent - 5;
				total++;
			}
			else {

				if (icurrent >= 2) {
					icurrent = icurrent - 2;
					total++;
				}
				else {

					if (icurrent >= 1) {
						icurrent = icurrent - 1;
						total++;
					}
				}
			}
		}
	}
	cout << total;

}