#include <iostream>
#include <string>

using namespace std;

int numbering(char num) {
	int n = num - '0';
	int br = 0;
	while(n != 0) {
		if(n >= 5) n -= 5;
		else if(n >= 2) n -= 2;
		else n--;
		br++;
	}
	return br;
}

int main() {
    string num;
	cin >> num;
	long long res = 0;
	for(int i = 0; i < num.size(); i++) {
		if(num[i] != 0) {
			res += numbering(num[i]);
		}
	}
	cout << res;	
	return 0;
}