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

int paperback(int n) {
    int c = 0;

    c += n / 5;
    n %= 5;

    c += n / 2;
    n %= 2;

    c += n;

    return c;
}

int main()
{
    long long v;
    cin >> v;

    int p = 0;
    while (v) {
        p += paperback(v % 10);
        v /= 10;
    }

    cout << p;
}