백준 1110번
numStr = input()
if len(numStr) == 1:
numStr = numStr + '0'
cycle = 0
num = numStr
while True:
nList = list(map(int, num))
if len(str(sum(nList))) == 2:
sList = list(str(sum(nList)))
sumNum = sList[1]
else:
sumNum = str(sum(nList))
numList = [nList[1], sumNum]
num = ''.join([str(x) for x in numList])
cycle = cycle + 1
if (num == numStr): break
print(cycle)