// Slower C++ solution:
/*     !ya khoda!     */

#include <bits/stdc++.h>



#define ll long long

#define ld long double



#define pp push

#define po pop()

#define pb push_back

#define pf push_front

#define pob pop_back()

#define pof pop_front()

#define I insert

#define E erase



#define F first

#define S second



#define mkp make_pair

#define pll pair<ll,ll>

#define smax(a,b) a=max(a,b)

#define smin(a,b) a=min(a,b)

#define all(a) a.begin(),a.end()



#define coutghat(x)      cout<<tolower(x);

#define coutashar(x,d)   cout<<fixed<<setprecision(x)<<(ld)d

#define IOS ios_base::sync_with_stdio(false) , cin.tie(0);



#define LB(x) ((x) & -(x))

#define BIT(a , b) (((a)>>(b)) & 1)

//#define poow(a,b,M)   b?(poow((a*a)%M,b/2)%M * (b&1?a))%M:1 ;

/*==========================================================================*/

using namespace std;

ll poow(ll x,ll n,ll Mod=1e9+7) { return (n==0?1:poow(x*x%Mod,n/2)*(n&1?x:1)%Mod); }

//#pragma optimize O3

// 107,109, 211,223, 307, 401,409, 503,509, 601,607, 701,709, 809, 907, 1009

/*==========================================================================*/

const int N=5e6+10  , M=1e4+10  , SQ=320 , LG=23 , base=2;

const int mod=1e9+7 , MOD=1e9+9;

const ll  INF=1e9   , inf=1e18 , super_inf=~0ull/4;

ll n,a[N],b[N] , p;

string s;

/*==========================================================================*/

ll check(ll x)

{   ll sum=0,p=0;

	for(int i=0;i<n;++i)   b[i]=a[i];

	b[0]+=x;

	for(int i=0;i<n;++i)

    {

		b[i]+=p;

		p=b[i]/10;

		b[i]%=10;

	}

	for(int i=0;i<n;++i)   sum+=b[i];

	if(sum<=x)   return 1;

	else         return 0;

}

/*==========================================================================*/

int main()

{

    IOS;

    cin>>s , n=s.size();

	reverse(all(s));

	for(int i=0;i<n;++i)   a[i]=s[i]-'0';

	for(int i=0;i<n;++i)   a[i]*=9;



	n+=20 , p=0;

	for(int i=0;i<n;++i)

    {

		a[i]+=p;

		p=a[i]/10;

		a[i]%=10;

	}



	ll l=0,r=INF;

	while(r-l>1)

    {   ll mid=l+r>>1;

		if(check(mid))   r=mid;

		else             l=mid;

	}



	cout<<(r+8)/9<<"\n";

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.436478077488698x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int MAXN=500005;



int len;

char N[MAXN];

int cnt[15];



int main()

{

    scanf("%s",N);

    len=strlen(N);

    reverse(N,N+len);

    for(int i=0;i<len;i++)

    {

        N[i]-='0';

        cnt[N[i]]++;

    }

    int ans=0;

    int tmp=len;

    int num=-1,pos=-1;

    for(;;)

    {

        int i=len-1;

        if(N[i]==num)

            i=pos-1;

        else

            while(i>0&&N[i-1]>=N[i])

                i--;

        ans++;

        if(i==0||cnt[N[0]]==len)

            break;

        while(N[i]==N[i+1])

            i++;

        num=N[i],pos=i;

        for(int j=len-1;j>=i;j--)

            cnt[N[j]]--;

        len=i;

        N[len]=0;

        cnt[N[0]]--;

        N[0]++;

        cnt[N[0]]++;

        for(int j=0;N[j]==10;j++)

        {

            cnt[N[j]]--;cnt[N[j+1]]--;

            N[j]=0,N[j+1]++;

            cnt[N[j]]++;cnt[N[j+1]]++;

        }

        /*for(int j=len;j<tmp;j++)

            putchar(' ');

        for(int j=len-1;j>=0;j--)

            putchar(N[j]+'0');

        putchar('\n');*/

    }

    printf("%d\n",ans);



    return 0;

}