// Original C++ solution (slower):
/*     !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;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#define SF scanf

#define PF printf

#define MAXN 500010

using namespace std;

int dig[MAXN];	

int top,ans;

char s[MAXN];

int main(){

	SF("%s",s);

	int len=strlen(s);

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

		dig[len-i-1]=s[i]-'0';

	top=len-1;

	int las=top;

	while(1){

		bool flag=0;

		if(top==0){

			if(dig[0]!=0)

				ans++;

			break;	

		}

		if(las<=top&&dig[las]>dig[las-1]&&dig[top]==dig[top-1]){

			top--;

			dig[top+1]=0;

			dig[0]++;

			int now=0;

			while(dig[now]>=10){

				dig[now+1]++;

				dig[now]%=10;

				now++;

				top=max(top,now+1);	

			}

			while(top>0&&dig[top]==0)

				top--;

			flag=1;

			ans++;

			continue;

		}

		for(int i=las-1;i>=0;i--)

			if(dig[i]<dig[i+1]){

				las=i+1;

				while(dig[i+1]==dig[i+2])

					i++;

				top=i;

				dig[top+1]=0;

				dig[0]++;

				int now=0;

				while(dig[now]>=10){

					dig[now+1]++;

					dig[now]%=10;

					now++;

					top=max(top,now+1);	

				}

				while(top>0&&dig[top]==0)

					top--;

				flag=1;

				break;

			}

		ans++;

		if(flag==0)

			break;

	}

	PF("%d",ans);

}	

// Fastest known solution for this problem: