시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 (추가 시간 없음) 512 MB 19 13 11 73.333%

문제

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