#include <bits/stdc++.h>
using namespace std;

int br_iz_cif(int x)
{
    int br = 0;
    while(x >= 5) {x -= 5; br++;}
    while(x >= 2) {x -= 2; br++;}
    while(x >= 1) {x -= 1; br++;}
    return br;
}

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

    cin >> v;

    do{br += br_iz_cif(v % 10);}while(v /= 10);

    cout << br << endl;

    return 0;
}