import decimal S = input() X = int(decimal.Decimal(S) * (10**9)) c = 10**9 ans = 0 while X: t = c % X c = X X = t ans += 1 print(ans)