#include <iostream>
using namespace std;

int main()
{
    long v;
    int ost;
    int br = 0;

    cin >> v;

    while(v != 0)
    {
        ost = v%10;
        while(ost >= 5)
        {
            ost = ost - 5;
            br = br + 1;
        }

        while(ost >= 2)
        {
            ost = ost - 2;
            br = br + 1;
        }

        while(ost >= 1)
        {
            ost = ost - 1;
            br = br + 1;
        }

        v = v / 10;
    }
    
    cout << br;

	return 0;
}