#include <iostream>
using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    string v;
    cin >> v;
    int brnovc = 0;
    int duzinastr = v.length();

    while(duzinastr > 0){

        while(v[duzinastr-1] > '0'){

            if(v[duzinastr-1] >= '5'){
                v[duzinastr-1]-= 5;
                brnovc++;
            }
            else if(v[duzinastr-1] >= '2'){
                v[duzinastr-1]-= 2;
                brnovc++;
            }
            else if(v[duzinastr-1] >= '1'){
                v[duzinastr-1]-= 1;
                brnovc++;
            }
        }
        duzinastr--;
    }

    cout << brnovc;
    return 0;
}