#include <stdio.h>
int main(){
int a,b,c,k = 0;
int result, cnt = 0;
scanf("%d",&k);
result = k;
while(1){
a = k / 10; //10의 자리
b = k % 10; //1의 자리
c = b*10 + ((a+b)%10);
k = c;
cnt ++;
if(c == result) break;
}
printf("%d",cnt);
}