#include <iostream>

using namespace std;

int main() {
    unsigned long long int v;
    unsigned int br;
    int x;
    cin >> v;
    
    while (v!=0) {
       x=v % 10;
       br+=x/5;
       x=x % 5;
       br+=x/2+ x % 2;
       v = v / 10; 
    }
    
    cout<<br;
}