#include <bits/stdc++.h>
using namespace std;
int suma(int o)
{
    int br = 0;

    while(o >= 5)
   {
       br++;
       o=o-5;
   }
    while(o >= 2)
    {
        br++;
        o=o-2;
    }
    while(o>=1)
    {
        br++;
        o=o-1;
    }
    return br;
}
int main()
{
   long long V , br=0;
   scanf("%lld", &V);
   while(V!= 0)
   {
      br=  br + suma(V% 10);
        V = V/10;

   }
    printf("%lld" , br);
return 0;
}