#include <stdio.h>
int main(void) {
int N, n;
int first, second,third;
int count = 0;
scanf("%d", &N);
n = N;
while(1)
{
first = n / 10;
second = n % 10;
third = (first + second) % 10;
n = second * 10 + third;
count++;
if (n == N) break;
}
printf("%d", count);
}