n = int(input()) if n < 1: print(-1) else: ans = 0 while n > 1: if n % 2 == 1: ans += 1 n += 1 ans += 1 n //= 2 print(ans)