#include<stdio.h>
void main(){
int n,t,x,c=0;
scanf("%d",&n);
while(1==1){
t=n;
x=0;
while(t!=0){
x=x*10+t%10;
t=t/10;
}
if(n==x){
break;
}else{
n=n+x;
c++;
}
}
printf("%d",c);
}
/**************************************************************
Problem: 1083
User: admin
Language: C
Result: Accepted
Time:8 ms
Memory:1144 kb
****************************************************************/