num=int(input()) a=int(num/10) b=num%10 cnt=0 while True: x=(a+b)%10 n=(b*10)+x a=b b=x cnt+=1 if n==num: break print(cnt)