시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB35520215655.914%

문제

You are given two integers, a and b. You want to transform a into b by performing a sequence of operations. You can only perform the following operations:

  • Divide a by two (but only if a is even)
  • Add one to a

What is the minimum number of operations you need to transform a into b?

입력

The single line of input contains two space-separated integers a and b (1 ≤ a, b ≤ 109)

출력

Output a single integer, which is the minimum number of the given operations needed to transform a into b.

예제 입력 1

103 27

예제 출력 1

4

예제 입력 2

3 8

예제 출력 2

5