using System;

class Takmicenje
{
    static void Main() {
        int k, V, kol, i, m, c;
        Console.Write("Unesi V: ");
        kol = 0;
        m = V.ToString().Lenght;
        k = V.ToString().Lenght;
        while (m > 0){
            c = (int)(V / (Math.Pow(10, (m-1))));
            for(i = k; i >= 0; i--){
                if (c >= 5){
                    c -= 5;
                    kol++;
                }
                else if(c >= 2){;
                c -= 2;
                kol++;
                }
                else if(c >= 1){;
                c -= 1;
                kol++;
                }
            }
            m--;
        Console.Write(kol);
    }
}