using System;

using System.Collections.Generic;

using System.Linq;

using System.Reflection.Emit;

using System.Text;

using System.Threading.Tasks;


class plus

{

    public void Action()

    {

        string b = Console.ReadLine();

        int z = int.Parse(b);

        int w = int.Parse(b);

        int counter = 0;

        do

        {

            counter++;

            int t = w;

            if (t < 10)

            {

                t *= 10;

            }

            string f = t.ToString();

            string[] a = f.Split();

            int x = int.Parse(a[0]);

            int y = int.Parse(a[1]);

            w = x + y;

            if (w == z)

            {

                Console.WriteLine(counter);

                break;

            }

        } while (true);

        

        

    }


    static void Main(string[] args)

    {

        plus plus = new plus();

        plus.Action();

    }

}

이거 왜안될까