n = int(input()) new = n count = 0 while True: tmp = new // 10 + new % 10 # 2 + 6 = 8, 6 + 8 = 14 new = int(str(new % 10) + str(tmp % 10)) # "6" + "8" = 68, "8" + "4" = 84 count += 1 if n == new: break print(count)